@final-commerce/command-frame 0.15.0-staging.1 → 0.15.0-staging.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  export * from './common-types';
2
- import type { Tax, Tip, Address, MetadataItem, OrderAssignedUser, OrderInCart, OrderCustomStatus, PosDataItem, CartFeeTaxEntry, CartFeeItem, CartDiscountItem, OrderNote, NonRevenueItem, DiscountDetail, FeeDetail, DiscountLineItem, FeeLineItem, LineItem, TipPayment, RefundedTipPayment, PaymentMethod, Discount, CustomFee, Summary, CustomSale, RefundedCustomSale, RefundItem, RefundedLineItem, ActiveStation, ActiveSession, ActiveOutlet, ActiveUser, ActiveUserRole, ActiveOrder, ActiveCart, ActivePark, ActiveCompany, ActiveCustomSales, ActiveProduct, ActiveCustomer, FullProduct, ProductVariant, Inventory, ResolvedModifier, ResolvedModifierChoice, ModifierSelectionType, ModifierSelection, ModifierChoiceSelection, CartLineModifier, ProdModifierBreakdown, OrderLineItemModifier, CustomerNote, Attribute, AttributeOption, Category, Transaction, ActiveSplitPayment, BookingAvailability, BookingSlot, BookingSlotResource, BookingResource, Booking, CartReservation, OrderReservation, CartAddress, CartShipping, Composite, CompositePart, CompositeItem, CompositeChoice, CompositeItemUnavailable, CompositePick, CartLineComponent, OrderLineItemComponent } from '@final-commerce/common/pos-types';
2
+ import type { Tax, Tip, Address, MetadataItem, OrderAssignedUser, OrderInCart, OrderCustomStatus, PosDataItem, CartFeeTaxEntry, CartFeeItem, CartDiscountItem, OrderNote, NonRevenueItem, DiscountDetail, FeeDetail, DiscountLineItem, FeeLineItem, LineItem, TipPayment, RefundedTipPayment, PaymentMethod, Discount, CustomFee, Summary, CustomSale, RefundedCustomSale, RefundItem, RefundedLineItem, ActiveStation, ActiveSession, ActiveOutlet, ActiveUser, ActiveUserRole, ActiveOrder, ActiveCart, ActivePark, ActiveCompany, ActiveCustomSales, ActiveProduct, ActiveCustomer, FullProduct, ProductVariant, Inventory, ResolvedModifier, ResolvedModifierChoice, ModifierSelectionType, ModifierSelection, ModifierChoiceSelection, CartLineModifier, ProdModifierBreakdown, OrderLineItemModifier, CustomerNote, Attribute, AttributeOption, Category, Transaction, ActiveSplitPayment, BookingAvailability, BookingSlot, BookingSlotResource, BookingResource, Booking, BookingRentalEnd, CartReservation, OrderReservation, CartAddress, CartShipping, Composite, CompositePart, CompositeItem, CompositeChoice, CompositeItemUnavailable, CompositePick, CartLineComponent, OrderLineItemComponent } from '@final-commerce/common/pos-types';
3
3
  export { CurrencyCode, ProductType as CFProductType, UserTypes as CFUserTypes } from '@final-commerce/common';
4
4
  /** Open record used as a base for active entities. */
5
5
  export type CFActiveEntity = Record<string, unknown>;
@@ -59,6 +59,7 @@ export type CFBookingSlot = BookingSlot;
59
59
  export type CFBookingSlotResource = BookingSlotResource;
60
60
  export type CFBookingResource = BookingResource;
61
61
  export type CFBooking = Booking;
62
+ export type CFBookingRentalEnd = BookingRentalEnd;
62
63
  /** A service sitting in the cart, and the same sale once it is on an order. A flow that draws a
63
64
  * cart or a receipt needs both by name — reaching into the package's dist for them is not an
64
65
  * interface. */
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Get booking rental ends action
3
+ * Calls the getBookingRentalEnds action on the parent window
4
+ */
5
+ import type { GetBookingRentalEnds } from './types';
6
+ export declare const getBookingRentalEnds: GetBookingRentalEnds;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Get booking rental ends action
3
+ * Calls the getBookingRentalEnds action on the parent window
4
+ */
5
+ import { commandFrameClient } from '../../client';
6
+ export const getBookingRentalEnds = async (params) => {
7
+ return await commandFrameClient.call('getBookingRentalEnds', params);
8
+ };
@@ -0,0 +1,2 @@
1
+ import { GetBookingRentalEnds } from './types';
2
+ export declare const mockGetBookingRentalEnds: GetBookingRentalEnds;
@@ -0,0 +1,6 @@
1
+ import { MOCK_ONLY_SINGLE_SLOTS } from '../hold-booking/mock';
2
+ // The mock shop has no date-range rules, so no stay can start in it — the same refusal `holdBooking` gives a stay.
3
+ export const mockGetBookingRentalEnds = async (params) => {
4
+ console.log('[Mock] getBookingRentalEnds called', params);
5
+ return { success: false, reason: MOCK_ONLY_SINGLE_SLOTS, timestamp: new Date().toISOString() };
6
+ };
@@ -0,0 +1,31 @@
1
+ import { CFBookingRentalEnd } from '../../CommonTypes';
2
+ export interface GetBookingRentalEndsParams {
3
+ /** The bookable product. Date-range rules only (hours, nights, days, weeks, months). */
4
+ productId: string;
5
+ /** The chosen check-in: the `startAt` of a slot `getBookingAvailability` offered, ISO 8601. */
6
+ startAt: string;
7
+ /**
8
+ * Last shop day an end may fall on, `YYYY-MM-DD` (the format of `getBookingAvailability`'s `fromDay`). Ends past it are
9
+ * not computed. Leave one page more than you show — a check-in on the last day, a whole week or month — and never a day
10
+ * before the chosen check-out; ask again with a later day when the cashier pages or steps past it. The shortest allowed
11
+ * stay comes even when it ends past it — alone — so a `minStay` longer than what you show still books.
12
+ */
13
+ untilDay: string;
14
+ /** The resource that must serve the whole stay. Omit for "any free one", picked per end exactly as the hold picks it. */
15
+ resourceId?: string;
16
+ /** Places the booking takes, as you will pass to `addBookingToCart`. Default 1. */
17
+ qty?: number;
18
+ }
19
+ export interface GetBookingRentalEndsResponse {
20
+ /** False when no stay can start here — a taken first night, a `minStay` the free nights do not reach, a non-range rule. */
21
+ success: boolean;
22
+ /** Why, in the host's own words. Absent on success. */
23
+ reason?: string;
24
+ /**
25
+ * Every end the stay may have now, ascending, never empty on success. Enable only these as check-out; highlight the
26
+ * chosen one's `coveredSlots`; send its `endAt` to `addBookingToCart`.
27
+ */
28
+ ends?: CFBookingRentalEnd[];
29
+ timestamp: string;
30
+ }
31
+ export type GetBookingRentalEnds = (params: GetBookingRentalEndsParams) => Promise<GetBookingRentalEndsResponse>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,3 @@
1
1
  import { HoldBooking } from './types';
2
+ export declare const MOCK_ONLY_SINGLE_SLOTS = "[Mock] the mock shop sells single 30-minute slots \u2014 pass the slot's endAt";
2
3
  export declare const mockHoldBooking: HoldBooking;
@@ -3,7 +3,7 @@ import { ReservationStatus, pickFreeResource } from '@final-commerce/common';
3
3
  const BUFFER_MINUTES = 5;
4
4
  const HOLD_MINUTES = 10;
5
5
  const TAKEN = 'That window has just been taken — pick another slot.';
6
- const MOCK_ONLY_SINGLE_SLOTS = "[Mock] the mock shop sells single 30-minute slots — pass the slot's endAt";
6
+ export const MOCK_ONLY_SINGLE_SLOTS = "[Mock] the mock shop sells single 30-minute slots — pass the slot's endAt";
7
7
  let held = 0;
8
8
  const refused = (reason) => ({
9
9
  success: false,
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export declare const command: {
4
4
  readonly getProducts: import(".").GetProducts;
5
5
  readonly getBookingResources: import(".").GetBookingResources;
6
6
  readonly getBookingAvailability: import(".").GetBookingAvailability;
7
+ readonly getBookingRentalEnds: import(".").GetBookingRentalEnds;
7
8
  readonly getBookings: import(".").GetBookings;
8
9
  readonly holdBooking: import(".").HoldBooking;
9
10
  readonly addBookingToCart: import(".").AddBookingToCart;
@@ -155,6 +156,7 @@ export type { GenerateAPIKey, GenerateAPIKeyParams, GenerateAPIKeyResponse } fro
155
156
  export type { GetProducts, GetProductsParams, GetProductsResponse } from './actions/get-products/types';
156
157
  export type { GetBookingResources, GetBookingResourcesParams, GetBookingResourcesResponse, } from './actions/get-booking-resources/types';
157
158
  export type { GetBookingAvailability, GetBookingAvailabilityParams, GetBookingAvailabilityResponse, } from './actions/get-booking-availability/types';
159
+ export type { GetBookingRentalEnds, GetBookingRentalEndsParams, GetBookingRentalEndsResponse, } from './actions/get-booking-rental-ends/types';
158
160
  export type { GetBookings, GetBookingsParams, GetBookingsResponse } from './actions/get-bookings/types';
159
161
  export type { HoldBooking, HoldBookingParams, HoldBookingResponse } from './actions/hold-booking/types';
160
162
  export type { AddBookingToCart, AddBookingToCartParams, AddBookingToCartResponse, } from './actions/add-booking-to-cart/types';
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@ import { exampleFunction } from './actions/example-function/action';
3
3
  import { getProducts } from './actions/get-products/action';
4
4
  import { getBookingResources } from './actions/get-booking-resources/action';
5
5
  import { getBookingAvailability } from './actions/get-booking-availability/action';
6
+ import { getBookingRentalEnds } from './actions/get-booking-rental-ends/action';
6
7
  import { getBookings } from './actions/get-bookings/action';
7
8
  import { holdBooking } from './actions/hold-booking/action';
8
9
  import { addBookingToCart } from './actions/add-booking-to-cart/action';
@@ -173,6 +174,7 @@ export const command = {
173
174
  getProducts,
174
175
  getBookingResources,
175
176
  getBookingAvailability,
177
+ getBookingRentalEnds,
176
178
  getBookings,
177
179
  holdBooking,
178
180
  addBookingToCart,
@@ -64,6 +64,7 @@ import { mockGetOrders } from '../../actions/get-orders/mock';
64
64
  import { mockGetProducts } from '../../actions/get-products/mock';
65
65
  import { mockGetBookingResources } from '../../actions/get-booking-resources/mock';
66
66
  import { mockGetBookingAvailability } from '../../actions/get-booking-availability/mock';
67
+ import { mockGetBookingRentalEnds } from '../../actions/get-booking-rental-ends/mock';
67
68
  import { mockGetBookings } from '../../actions/get-bookings/mock';
68
69
  import { mockHoldBooking } from '../../actions/hold-booking/mock';
69
70
  import { mockAddBookingToCart } from '../../actions/add-booking-to-cart/mock';
@@ -195,6 +196,7 @@ export const RENDER_MOCKS = {
195
196
  getProducts: mockGetProducts,
196
197
  getBookingResources: mockGetBookingResources,
197
198
  getBookingAvailability: mockGetBookingAvailability,
199
+ getBookingRentalEnds: mockGetBookingRentalEnds,
198
200
  getBookings: mockGetBookings,
199
201
  holdBooking: mockHoldBooking,
200
202
  addBookingToCart: mockAddBookingToCart,
@@ -1,9 +1,10 @@
1
- import type { ExampleFunction, GetProducts, AddCustomSale, EditCustomSale, GetCustomers, AssignCustomer, AddCustomer, EditCustomer, GetCategories, GetOrders, GetRefunds, GetTaxTables, GetCustomStockActions, AddProductDiscount, AddProductToCart, RemoveProductFromCart, UpdateCartItemQuantity, AddCartDiscount, GetContext, GetFinalContext, AddProductNote, AddProductFee, GetProductModifierSelections, GetCompositePrice, GetCompositeAvailability, SetProductModifierSelections, SetActiveProductFee, SetActiveProductDiscount, GetActiveProduct, SetActiveProduct, AdjustInventory, SetVariantUnavailable, AddOrderNote, AddCartFee, ClearCart, ParkOrder, ResumeParkedOrder, ResumeOrder, SetOrderMetadata, AssignOrderUser, ReleaseFromCart, SetOrderType, SetScheduledFor, SetOrderStatus, GetOrderStatuses, DeleteParkedOrder, VoidOrder, InitiateRefund, CashPayment, RecordExternalPayment, GetCashRoundingAmount, GetCashChange, GetOrdersSummary, 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, StartCheckout, AttachCheckoutContact, GetAddressOptions, SetOrderAddress, GetShippingOptions, SelectShippingOption, GetOutlets, SetOutlet, ResumeCheckout, GetCheckoutStatus, GetMotoConfig, GetTimeClockStatus } from '../../index';
1
+ import type { ExampleFunction, GetProducts, AddCustomSale, EditCustomSale, GetCustomers, AssignCustomer, AddCustomer, EditCustomer, GetCategories, GetOrders, GetRefunds, GetTaxTables, GetCustomStockActions, AddProductDiscount, AddProductToCart, RemoveProductFromCart, UpdateCartItemQuantity, AddCartDiscount, GetContext, GetFinalContext, AddProductNote, AddProductFee, GetProductModifierSelections, GetCompositePrice, GetCompositeAvailability, SetProductModifierSelections, SetActiveProductFee, SetActiveProductDiscount, GetActiveProduct, SetActiveProduct, AdjustInventory, SetVariantUnavailable, AddOrderNote, AddCartFee, ClearCart, ParkOrder, ResumeParkedOrder, ResumeOrder, SetOrderMetadata, AssignOrderUser, ReleaseFromCart, SetOrderType, SetScheduledFor, SetOrderStatus, GetOrderStatuses, DeleteParkedOrder, VoidOrder, InitiateRefund, CashPayment, RecordExternalPayment, GetCashRoundingAmount, GetCashChange, GetOrdersSummary, 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, GetBookingRentalEnds, GetBookings, HoldBooking, AddBookingToCart, RemoveBookingFromCart, CancelBooking, CreatePaymentLink, ChargeMoto, StartCheckout, AttachCheckoutContact, GetAddressOptions, SetOrderAddress, GetShippingOptions, SelectShippingOption, GetOutlets, SetOutlet, ResumeCheckout, GetCheckoutStatus, GetMotoConfig, GetTimeClockStatus } from '../../index';
2
2
  export interface RenderProviderActions {
3
3
  exampleFunction: ExampleFunction;
4
4
  getProducts: GetProducts;
5
5
  getBookingResources: GetBookingResources;
6
6
  getBookingAvailability: GetBookingAvailability;
7
+ getBookingRentalEnds: GetBookingRentalEnds;
7
8
  getBookings: GetBookings;
8
9
  holdBooking: HoldBooking;
9
10
  addBookingToCart: AddBookingToCart;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@final-commerce/command-frame",
3
- "version": "0.15.0-staging.1",
3
+ "version": "0.15.0-staging.2",
4
4
  "description": "Commands Frame library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -57,7 +57,7 @@
57
57
  "ignoreBranchesMissingTickets": true
58
58
  },
59
59
  "dependencies": {
60
- "@final-commerce/common": "2.12.0-staging.1"
60
+ "@final-commerce/common": "2.12.0-staging.2"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@commitlint/cli": "^19.0.0",