@final-commerce/command-frame 0.8.1-online.1 → 0.9.0-preprod.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 (56) hide show
  1. package/dist/CommonTypes.d.ts +0 -14
  2. package/dist/actions/adjust-inventory/mock.js +20 -0
  3. package/dist/actions/adjust-inventory/types.d.ts +13 -0
  4. package/dist/actions/adjust-inventory/types.js +1 -0
  5. package/dist/actions/get-custom-stock-actions/action.d.ts +5 -0
  6. package/dist/actions/get-custom-stock-actions/action.js +7 -0
  7. package/dist/actions/get-custom-stock-actions/mock.d.ts +2 -0
  8. package/dist/actions/get-custom-stock-actions/mock.js +11 -0
  9. package/dist/actions/get-custom-stock-actions/types.d.ts +12 -0
  10. package/dist/actions/get-custom-stock-actions/types.js +2 -0
  11. package/dist/actions/get-outlets/action.js +2 -2
  12. package/dist/actions/get-outlets/mock.d.ts +0 -12
  13. package/dist/actions/get-outlets/mock.js +4 -28
  14. package/dist/actions/get-outlets/types.d.ts +1 -19
  15. package/dist/index.d.ts +4 -12
  16. package/dist/index.js +2 -9
  17. package/dist/projects/render/mocks.js +2 -10
  18. package/dist/projects/render/types.d.ts +2 -16
  19. package/dist/pubsub/topics/index.d.ts +17 -18
  20. package/dist/pubsub/topics/index.js +17 -18
  21. package/dist/pubsub/topics/types.d.ts +0 -8
  22. package/package.json +2 -2
  23. package/dist/actions/attach-checkout-contact/action.d.ts +0 -6
  24. package/dist/actions/attach-checkout-contact/action.js +0 -8
  25. package/dist/actions/attach-checkout-contact/mock.d.ts +0 -15
  26. package/dist/actions/attach-checkout-contact/mock.js +0 -22
  27. package/dist/actions/attach-checkout-contact/types.d.ts +0 -35
  28. package/dist/actions/attach-checkout-contact/types.js +0 -16
  29. package/dist/actions/resume-checkout/action.d.ts +0 -6
  30. package/dist/actions/resume-checkout/action.js +0 -8
  31. package/dist/actions/resume-checkout/mock.d.ts +0 -16
  32. package/dist/actions/resume-checkout/mock.js +0 -51
  33. package/dist/actions/resume-checkout/types.d.ts +0 -59
  34. package/dist/actions/resume-checkout/types.js +0 -13
  35. package/dist/actions/set-outlet/action.d.ts +0 -6
  36. package/dist/actions/set-outlet/action.js +0 -8
  37. package/dist/actions/set-outlet/mock.d.ts +0 -13
  38. package/dist/actions/set-outlet/mock.js +0 -24
  39. package/dist/actions/set-outlet/types.d.ts +0 -31
  40. package/dist/actions/set-outlet/types.js +0 -21
  41. package/dist/actions/start-checkout/action.d.ts +0 -6
  42. package/dist/actions/start-checkout/action.js +0 -8
  43. package/dist/actions/start-checkout/mock.d.ts +0 -16
  44. package/dist/actions/start-checkout/mock.js +0 -80
  45. package/dist/actions/start-checkout/types.d.ts +0 -90
  46. package/dist/actions/start-checkout/types.js +0 -10
  47. package/dist/pubsub/topics/checkout/checkout-started/types.d.ts +0 -26
  48. package/dist/pubsub/topics/checkout/checkout-started/types.js +0 -1
  49. package/dist/pubsub/topics/checkout/index.d.ts +0 -7
  50. package/dist/pubsub/topics/checkout/index.js +0 -28
  51. package/dist/pubsub/topics/checkout/payment-completed/types.d.ts +0 -31
  52. package/dist/pubsub/topics/checkout/payment-completed/types.js +0 -1
  53. package/dist/pubsub/topics/checkout/payment-failed/types.d.ts +0 -20
  54. package/dist/pubsub/topics/checkout/payment-failed/types.js +0 -1
  55. package/dist/pubsub/topics/checkout/types.d.ts +0 -12
  56. package/dist/pubsub/topics/checkout/types.js +0 -8
@@ -181,23 +181,9 @@ export interface CFOutletInfo {
181
181
  state?: string;
182
182
  postCode?: string;
183
183
  };
184
- address2?: string;
185
184
  city?: string;
186
185
  state?: string;
187
186
  country?: string;
188
- postCode?: string;
189
- phone?: string;
190
- /** Short display alias, when the merchant set one (e.g. `DTWN`). */
191
- alias?: string;
192
- /**
193
- * Whether this location can take an ONLINE payment. Storefront only — it is
194
- * absent on a register, where it has no meaning.
195
- *
196
- * `false` means the outlet has no completed payment connection, so starting a
197
- * checkout against it WILL fail. A pickup picker must not offer it as a
198
- * selectable location, or must show it as unavailable.
199
- */
200
- connected?: boolean;
201
187
  }
202
188
  export interface CFContextManage {
203
189
  user: unknown;
@@ -1,6 +1,26 @@
1
1
  import { MOCK_PRODUCTS } from '../../demo/database';
2
+ // Same rules and messages as the kaching handler.
3
+ const STOCK_TYPE_BY_REASON = {
4
+ STOCK_RECEIVED: 'add',
5
+ RESTOCK_RETURN: 'add',
6
+ DAMAGE: 'subtract',
7
+ THEFT: 'subtract',
8
+ LOSS: 'subtract',
9
+ INVENTORY_RECOUNT: 'set',
10
+ };
2
11
  export const mockAdjustInventory = async (params) => {
3
12
  console.log('[Mock] adjustInventory called', params);
13
+ if (params?.specificAction != null) {
14
+ const { specificAction, stockType, customActionId } = params;
15
+ if (customActionId)
16
+ throw new Error('Pass either customActionId or specificAction, not both');
17
+ const reasonStockType = STOCK_TYPE_BY_REASON[specificAction];
18
+ if (!reasonStockType)
19
+ throw new Error(`Unknown specificAction: ${specificAction}`);
20
+ if (reasonStockType !== stockType) {
21
+ throw new Error(`specificAction ${specificAction} requires stockType '${reasonStockType}', got '${stockType}'`);
22
+ }
23
+ }
4
24
  let newStock = 0;
5
25
  // Real handler keys off variantId (falling back to the active product's
6
26
  // variant); mirror that here by finding the owning product for the variant.
@@ -1,3 +1,5 @@
1
+ /** The manual reasons a person can pick, as hub-api's InventorySpecificActionType names them. */
2
+ export type ManualStockReason = 'STOCK_RECEIVED' | 'RESTOCK_RETURN' | 'DAMAGE' | 'THEFT' | 'LOSS' | 'INVENTORY_RECOUNT';
1
3
  export interface AdjustInventoryParams {
2
4
  /** String to preserve precision. */
3
5
  amount: string;
@@ -5,6 +7,17 @@ export interface AdjustInventoryParams {
5
7
  stockType: 'add' | 'subtract' | 'set';
6
8
  /** Variant to adjust. Omit to use the active product's selected variant. */
7
9
  variantId?: string;
10
+ /**
11
+ * A company action from getCustomStockActions. The movement is recorded under its name;
12
+ * `stockType` must match its baseAction (ADD → 'add', REMOVE → 'subtract', RECOUNT → 'set').
13
+ */
14
+ customActionId?: string;
15
+ /**
16
+ * A built-in reason to record instead of the host's default for `stockType`. Must match it:
17
+ * STOCK_RECEIVED / RESTOCK_RETURN → 'add', DAMAGE / THEFT / LOSS → 'subtract', INVENTORY_RECOUNT → 'set'.
18
+ * Rejected together with `customActionId`.
19
+ */
20
+ specificAction?: ManualStockReason;
8
21
  }
9
22
  export interface AdjustInventoryResponse {
10
23
  success: boolean;
@@ -1 +1,2 @@
1
+ // Adjust Inventory Types
1
2
  export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Get custom stock actions action — the company's own stock adjustment actions.
3
+ */
4
+ import type { GetCustomStockActions } from './types';
5
+ export declare const getCustomStockActions: GetCustomStockActions;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Get custom stock actions action — the company's own stock adjustment actions.
3
+ */
4
+ import { commandFrameClient } from '../../client';
5
+ export const getCustomStockActions = async () => {
6
+ return await commandFrameClient.call('getCustomStockActions');
7
+ };
@@ -0,0 +1,2 @@
1
+ import { GetCustomStockActions } from './types';
2
+ export declare const mockGetCustomStockActions: GetCustomStockActions;
@@ -0,0 +1,11 @@
1
+ export const mockGetCustomStockActions = async () => {
2
+ console.log('[Mock] getCustomStockActions called');
3
+ return {
4
+ customStockActions: [
5
+ { _id: 'mock_custom_action_1', name: 'Opening stock', baseAction: 'ADD' },
6
+ { _id: 'mock_custom_action_2', name: 'Exhibition loan', baseAction: 'REMOVE' },
7
+ { _id: 'mock_custom_action_3', name: 'Year-end count', baseAction: 'RECOUNT' },
8
+ ],
9
+ timestamp: new Date().toISOString(),
10
+ };
11
+ };
@@ -0,0 +1,12 @@
1
+ export interface CustomStockActionPayload {
2
+ _id: string;
3
+ /** Name the company gave the action, shown in pickers and stock history. */
4
+ name: string;
5
+ /** What the action does to stock — pass the matching `stockType` to adjustInventory. */
6
+ baseAction: 'ADD' | 'REMOVE' | 'RECOUNT';
7
+ }
8
+ export interface GetCustomStockActionsResponse {
9
+ customStockActions: CustomStockActionPayload[];
10
+ timestamp: string;
11
+ }
12
+ export type GetCustomStockActions = () => Promise<GetCustomStockActionsResponse>;
@@ -0,0 +1,2 @@
1
+ // Get Custom Stock Actions Types
2
+ export {};
@@ -1,4 +1,4 @@
1
1
  import { commandFrameClient } from "../../client";
2
- export const getOutlets = async (params) => {
3
- return await commandFrameClient.call("getOutlets", params ?? {});
2
+ export const getOutlets = async () => {
3
+ return await commandFrameClient.call("getOutlets");
4
4
  };
@@ -1,14 +1,2 @@
1
1
  import { GetOutlets } from "./types";
2
- /**
3
- * A second location that CANNOT take an online payment.
4
- *
5
- * The shared demo data has exactly one outlet, so without this a pickup picker
6
- * built against mocks would never render the case that matters: an outlet a
7
- * shopper must not be allowed to check out against. `setOutlet` refuses this id,
8
- * so the two mocks tell the same story.
9
- *
10
- * Mock-only, and deliberately NOT added to `MOCK_OUTLETS` — that array is shared
11
- * with every other outlet mock and `MOCK_OUTLET`.
12
- */
13
- export declare const MOCK_UNCONNECTED_OUTLET_ID = "outlet-mock-unconnected";
14
2
  export declare const mockGetOutlets: GetOutlets;
@@ -1,40 +1,16 @@
1
1
  import { MOCK_OUTLETS, safeSerialize } from "../../demo/database";
2
- /**
3
- * A second location that CANNOT take an online payment.
4
- *
5
- * The shared demo data has exactly one outlet, so without this a pickup picker
6
- * built against mocks would never render the case that matters: an outlet a
7
- * shopper must not be allowed to check out against. `setOutlet` refuses this id,
8
- * so the two mocks tell the same story.
9
- *
10
- * Mock-only, and deliberately NOT added to `MOCK_OUTLETS` — that array is shared
11
- * with every other outlet mock and `MOCK_OUTLET`.
12
- */
13
- export const MOCK_UNCONNECTED_OUTLET_ID = "outlet-mock-unconnected";
14
- const UNCONNECTED_OUTLET = {
15
- _id: MOCK_UNCONNECTED_OUTLET_ID,
16
- name: "Airport (not connected)",
17
- address: "2 Terminal Road",
18
- city: "San Francisco",
19
- state: "CA",
20
- country: "US",
21
- postCode: "94128",
22
- connected: false
23
- };
24
- export const mockGetOutlets = async (params) => {
25
- console.log("[Mock] getOutlets called", params);
2
+ export const mockGetOutlets = async () => {
3
+ console.log("[Mock] getOutlets called");
26
4
  const outlets = safeSerialize(MOCK_OUTLETS).map((o) => ({
27
5
  _id: o._id || o.id,
28
6
  name: o.name || "",
29
7
  address: o.address,
30
8
  city: o.city,
31
9
  state: o.state,
32
- country: o.country,
33
- connected: true
10
+ country: o.country
34
11
  }));
35
- const all = [...outlets, UNCONNECTED_OUTLET];
36
12
  return {
37
- outlets: params?.connectedOnly ? all.filter((o) => o.connected) : all,
13
+ outlets,
38
14
  timestamp: new Date().toISOString()
39
15
  };
40
16
  };
@@ -1,24 +1,6 @@
1
1
  import { CFOutletInfo } from "../../CommonTypes";
2
- export interface GetOutletsParams {
3
- /**
4
- * Return only locations that can take an online payment. Storefront only.
5
- * Default `false`, so a flow sees every outlet and decides how to present
6
- * the ones it cannot sell from.
7
- */
8
- connectedOnly?: boolean;
9
- }
10
2
  export interface GetOutletsResponse {
11
3
  outlets: CFOutletInfo[];
12
4
  timestamp: string;
13
5
  }
14
- /**
15
- * List the company's outlets.
16
- *
17
- * ON A STOREFRONT this is the pickup picker's source. Each outlet carries
18
- * `connected`, and an outlet with `connected: false` cannot take a payment, so
19
- * `setOutlet` refuses it — filter those out rather than relying on the refusal.
20
- *
21
- * There are no coordinates on an outlet, so "closest branch" is not something
22
- * this can answer; sort on the address fields or let the shopper choose.
23
- */
24
- export type GetOutlets = (params?: GetOutletsParams) => Promise<GetOutletsResponse>;
6
+ export type GetOutlets = () => Promise<GetOutletsResponse>;
package/dist/index.d.ts CHANGED
@@ -35,6 +35,7 @@ export declare const command: {
35
35
  readonly getActiveProduct: import(".").GetActiveProduct;
36
36
  readonly setActiveProduct: import(".").SetActiveProduct;
37
37
  readonly adjustInventory: import(".").AdjustInventory;
38
+ readonly getCustomStockActions: import(".").GetCustomStockActions;
38
39
  readonly addOrderNote: import(".").AddOrderNote;
39
40
  readonly addCartFee: import(".").AddCartFee;
40
41
  readonly getCurrentCart: import(".").GetCurrentCart;
@@ -52,10 +53,6 @@ export declare const command: {
52
53
  readonly integrationPayment: import(".").IntegrationPayment;
53
54
  readonly createPaymentLink: import(".").CreatePaymentLink;
54
55
  readonly chargeMoto: import(".").ChargeMoto;
55
- readonly startCheckout: import(".").StartCheckout;
56
- readonly attachCheckoutContact: import(".").AttachCheckoutContact;
57
- readonly setOutlet: import(".").SetOutlet;
58
- readonly resumeCheckout: import(".").ResumeCheckout;
59
56
  readonly addCustomerNote: import(".").AddCustomerNote;
60
57
  readonly removeCustomerNote: import(".").RemoveCustomerNote;
61
58
  readonly removeCustomerFromCart: import(".").RemoveCustomerFromCart;
@@ -151,7 +148,7 @@ export type { AddProduct, AddProductParams, AddProductResponse } from './actions
151
148
  export type { EditProduct, EditProductParams, EditProductResponse } from './actions/edit-product/types';
152
149
  export type { EditProductVariants, EditProductVariantsParams, EditProductVariantsResponse, } from './actions/edit-product-variants/types';
153
150
  export type { DeleteProduct, DeleteProductParams, DeleteProductResponse } from './actions/delete-product/types';
154
- export type { GetOutlets, GetOutletsParams, GetOutletsResponse } from './actions/get-outlets/types';
151
+ export type { GetOutlets, GetOutletsResponse } from './actions/get-outlets/types';
155
152
  export type { GetStations, GetStationsParams, GetStationsResponse } from './actions/get-stations/types';
156
153
  export type { GetSmartGridLayout, GetSmartGridLayoutParams, GetSmartGridLayoutResponse, } from './actions/get-smart-grid-layout/types';
157
154
  export type { SaveSmartGridLayout, SaveSmartGridLayoutParams, SaveSmartGridLayoutResponse, } from './actions/save-smart-grid-layout/types';
@@ -183,7 +180,8 @@ export type { SetActiveProductFee, SetActiveProductFeeParams, SetActiveProductFe
183
180
  export type { SetActiveProductDiscount, SetActiveProductDiscountParams, SetActiveProductDiscountResponse, } from './actions/set-active-product-discount/types';
184
181
  export type { GetActiveProduct, GetActiveProductResponse } from './actions/get-active-product/types';
185
182
  export type { SetActiveProduct, SetActiveProductParams, SetActiveProductResponse, } from './actions/set-active-product/types';
186
- export type { AdjustInventory, AdjustInventoryParams, AdjustInventoryResponse } from './actions/adjust-inventory/types';
183
+ export type { AdjustInventory, AdjustInventoryParams, AdjustInventoryResponse, ManualStockReason, } from './actions/adjust-inventory/types';
184
+ export type { CustomStockActionPayload, GetCustomStockActions, GetCustomStockActionsResponse, } from './actions/get-custom-stock-actions/types';
187
185
  export type { AddOrderNote, AddOrderNoteParams, AddOrderNoteResponse } from './actions/add-order-note/types';
188
186
  export type { AddCartFee, AddCartFeeParams, AddCartFeeResponse } from './actions/add-cart-fee/types';
189
187
  export type { ClearCart, ClearCartResponse } from './actions/clear-cart/types';
@@ -200,10 +198,6 @@ export type { RedeemPayment, RedeemPaymentParams, RedeemPaymentResponse } from '
200
198
  export type { IntegrationPayment, IntegrationPaymentParams, IntegrationPaymentResponse, IntegrationEmvData, } from './actions/integration-payment/types';
201
199
  export type { CreatePaymentLink, CreatePaymentLinkParams, CreatePaymentLinkResponse, } from './actions/create-payment-link/types';
202
200
  export type { ChargeMoto, ChargeMotoParams, ChargeMotoResponse, ChargeMotoCardFields, } from './actions/charge-moto/types';
203
- export type { StartCheckout, StartCheckoutParams, StartCheckoutResponse, StartCheckoutContact, StartCheckoutOrder, } from './actions/start-checkout/types';
204
- export type { AttachCheckoutContact, AttachCheckoutContactParams, AttachCheckoutContactResponse, } from './actions/attach-checkout-contact/types';
205
- export type { SetOutlet, SetOutletParams, SetOutletResponse } from './actions/set-outlet/types';
206
- export type { ResumeCheckout, ResumeCheckoutParams, ResumeCheckoutResponse, ResumeCheckoutResult, } from './actions/resume-checkout/types';
207
201
  export type { AddCustomerNote, AddCustomerNoteParams, AddCustomerNoteResponse, } from './actions/add-customer-note/types';
208
202
  export type { RemoveCustomerNote, RemoveCustomerNoteParams, RemoveCustomerNoteResponse, } from './actions/remove-customer-note/types';
209
203
  export type { RemoveCustomerFromCart, RemoveCustomerFromCartResponse } from './actions/remove-customer-from-cart/types';
@@ -260,7 +254,6 @@ export { refundsTopic } from './pubsub/topics/refunds';
260
254
  export { productsTopic } from './pubsub/topics/products';
261
255
  export { cartTopic } from './pubsub/topics/cart';
262
256
  export { paymentsTopic } from './pubsub/topics/payments';
263
- export { checkoutTopic } from './pubsub/topics/checkout';
264
257
  export { splitPaymentsTopic } from './pubsub/topics/split-payments';
265
258
  export { customTablesTopic } from './pubsub/topics/custom-tables';
266
259
  export { printTopic } from './pubsub/topics/print';
@@ -288,7 +281,6 @@ export type { CategoryCreatedPayload, CategoryCreatedEvent, CategoryUpdatedPaylo
288
281
  export type { AttributeCreatedPayload, AttributeCreatedEvent, AttributeUpdatedPayload, AttributeUpdatedEvent, AttributesEventType, AttributesEventPayload, } from './pubsub/topics/attributes/types';
289
282
  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';
290
283
  export type { PaymentDonePayload, PaymentErrPayload, PaymentDoneEvent, PaymentErrEvent, PaymentsEventType, PaymentsEventPayload, } from './pubsub/topics/payments/types';
291
- export type { CheckoutStartedPayload, PaymentCompletedPayload, PaymentFailedPayload, CheckoutStartedEvent, PaymentCompletedEvent, PaymentFailedEvent, CheckoutEventType, CheckoutEventPayload, } from './pubsub/topics/checkout/types';
292
284
  export type { SplitPaymentUpdatedPayload, SplitPaymentUpdatedEvent, SplitPaymentsEventType, SplitPaymentsEventPayload, } from './pubsub/topics/split-payments/types';
293
285
  export type { RowCreatedPayload, RowUpdatedPayload, RowDeletedPayload, RowCreatedEvent, RowUpdatedEvent, RowDeletedEvent, CustomTablesEventType, CustomTablesEventPayload, } from './pubsub/topics/custom-tables/types';
294
286
  export type { PrintStartedPayload, PrintCompletedPayload, PrintErrorPayload, PrintStartedEvent, PrintCompletedEvent, PrintErrorEvent, PrintEventType, PrintEventPayload, } from './pubsub/topics/print/types';
package/dist/index.js CHANGED
@@ -34,6 +34,7 @@ import { setActiveProductDiscount } from './actions/set-active-product-discount/
34
34
  import { getActiveProduct } from './actions/get-active-product/action';
35
35
  import { setActiveProduct } from './actions/set-active-product/action';
36
36
  import { adjustInventory } from './actions/adjust-inventory/action';
37
+ import { getCustomStockActions } from './actions/get-custom-stock-actions/action';
37
38
  // Order Actions
38
39
  import { addOrderNote } from './actions/add-order-note/action';
39
40
  import { addCartFee } from './actions/add-cart-fee/action';
@@ -52,10 +53,6 @@ import { redeemPayment } from './actions/redeem-payment/action';
52
53
  import { integrationPayment } from './actions/integration-payment/action';
53
54
  import { createPaymentLink } from './actions/create-payment-link/action';
54
55
  import { chargeMoto } from './actions/charge-moto/action';
55
- import { startCheckout } from './actions/start-checkout/action';
56
- import { attachCheckoutContact } from './actions/attach-checkout-contact/action';
57
- import { setOutlet } from './actions/set-outlet/action';
58
- import { resumeCheckout } from './actions/resume-checkout/action';
59
56
  // Customer Actions
60
57
  import { addCustomerNote } from './actions/add-customer-note/action';
61
58
  import { removeCustomerNote } from './actions/remove-customer-note/action';
@@ -184,6 +181,7 @@ export const command = {
184
181
  getActiveProduct,
185
182
  setActiveProduct,
186
183
  adjustInventory,
184
+ getCustomStockActions,
187
185
  // Order Actions
188
186
  addOrderNote,
189
187
  addCartFee,
@@ -202,10 +200,6 @@ export const command = {
202
200
  integrationPayment,
203
201
  createPaymentLink,
204
202
  chargeMoto,
205
- startCheckout,
206
- attachCheckoutContact,
207
- setOutlet,
208
- resumeCheckout,
209
203
  // Customer Actions
210
204
  addCustomerNote,
211
205
  removeCustomerNote,
@@ -316,7 +310,6 @@ export { refundsTopic } from './pubsub/topics/refunds';
316
310
  export { productsTopic } from './pubsub/topics/products';
317
311
  export { cartTopic } from './pubsub/topics/cart';
318
312
  export { paymentsTopic } from './pubsub/topics/payments';
319
- export { checkoutTopic } from './pubsub/topics/checkout';
320
313
  export { splitPaymentsTopic } from './pubsub/topics/split-payments';
321
314
  export { customTablesTopic } from './pubsub/topics/custom-tables';
322
315
  export { printTopic } from './pubsub/topics/print';
@@ -26,6 +26,7 @@ import { mockRemoveProductFromCart } from '../../actions/remove-product-from-car
26
26
  import { mockRemoveCartDiscount } from '../../actions/remove-cart-discount/mock';
27
27
  import { mockUpdateCartItemQuantity } from '../../actions/update-cart-item-quantity/mock';
28
28
  import { mockAdjustInventory } from '../../actions/adjust-inventory/mock';
29
+ import { mockGetCustomStockActions } from '../../actions/get-custom-stock-actions/mock';
29
30
  import { mockAssignCustomer } from '../../actions/assign-customer/mock';
30
31
  import { mockAuthenticateUser } from '../../actions/authenticate-user/mock';
31
32
  import { mockCalculateRefundTotal } from '../../actions/calculate-refund-total/mock';
@@ -33,11 +34,6 @@ import { mockCashPayment } from '../../actions/cash-payment/mock';
33
34
  import { mockGetCashRoundingAmount } from '../../actions/get-cash-rounding-amount/mock';
34
35
  import { mockCreatePaymentLink } from '../../actions/create-payment-link/mock';
35
36
  import { mockChargeMoto } from '../../actions/charge-moto/mock';
36
- import { mockStartCheckout } from '../../actions/start-checkout/mock';
37
- import { mockAttachCheckoutContact } from '../../actions/attach-checkout-contact/mock';
38
- import { mockGetOutlets } from '../../actions/get-outlets/mock';
39
- import { mockSetOutlet } from '../../actions/set-outlet/mock';
40
- import { mockResumeCheckout } from '../../actions/resume-checkout/mock';
41
37
  import { mockGetTimeClockStatus } from '../../actions/get-time-clock-status/mock';
42
38
  import { mockClearCart } from '../../actions/clear-cart/mock';
43
39
  import { mockDeleteParkedOrder } from '../../actions/delete-parked-order/mock';
@@ -137,6 +133,7 @@ export const RENDER_MOCKS = {
137
133
  removeProductFromCart: mockRemoveProductFromCart,
138
134
  updateCartItemQuantity: mockUpdateCartItemQuantity,
139
135
  adjustInventory: mockAdjustInventory,
136
+ getCustomStockActions: mockGetCustomStockActions,
140
137
  assignCustomer: mockAssignCustomer,
141
138
  authenticateUser: mockAuthenticateUser,
142
139
  calculateRefundTotal: mockCalculateRefundTotal,
@@ -144,11 +141,6 @@ export const RENDER_MOCKS = {
144
141
  getCashRoundingAmount: mockGetCashRoundingAmount,
145
142
  createPaymentLink: mockCreatePaymentLink,
146
143
  chargeMoto: mockChargeMoto,
147
- startCheckout: mockStartCheckout,
148
- attachCheckoutContact: mockAttachCheckoutContact,
149
- getOutlets: mockGetOutlets,
150
- setOutlet: mockSetOutlet,
151
- resumeCheckout: mockResumeCheckout,
152
144
  clearCart: mockClearCart,
153
145
  deleteParkedOrder: mockDeleteParkedOrder,
154
146
  voidOrder: mockVoidOrder,
@@ -1,4 +1,4 @@
1
- import type { ExampleFunction, GetProducts, AddCustomSale, EditCustomSale, GetCustomers, AssignCustomer, AddCustomer, EditCustomer, GetCategories, GetOrders, GetRefunds, GetTaxTables, AddProductDiscount, AddProductToCart, RemoveProductFromCart, UpdateCartItemQuantity, AddCartDiscount, GetContext, GetFinalContext, AddProductNote, AddProductFee, GetProductModifierSelections, SetProductModifierSelections, 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, StartCheckout, AttachCheckoutContact, GetOutlets, SetOutlet, ResumeCheckout, 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, SetProductModifierSelections, 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';
2
2
  export interface RenderProviderActions {
3
3
  exampleFunction: ExampleFunction;
4
4
  getProducts: GetProducts;
@@ -35,6 +35,7 @@ export interface RenderProviderActions {
35
35
  getActiveProduct: GetActiveProduct;
36
36
  setActiveProduct: SetActiveProduct;
37
37
  adjustInventory: AdjustInventory;
38
+ getCustomStockActions: GetCustomStockActions;
38
39
  addOrderNote: AddOrderNote;
39
40
  addCartFee: AddCartFee;
40
41
  clearCart: ClearCart;
@@ -52,21 +53,6 @@ export interface RenderProviderActions {
52
53
  integrationPayment: IntegrationPayment;
53
54
  createPaymentLink: CreatePaymentLink;
54
55
  chargeMoto: ChargeMoto;
55
- /**
56
- * ONLINE checkout — served only by the storefront runtime (a published
57
- * website). The till tenders above are refused there, and this is refused on
58
- * a register, because the two declare different things to the card networks.
59
- */
60
- startCheckout: StartCheckout;
61
- attachCheckoutContact: AttachCheckoutContact;
62
- getOutlets: GetOutlets;
63
- setOutlet: SetOutlet;
64
- /**
65
- * The RETURN LEG of an online checkout, after a redirect payment method or
66
- * 3-D Secure sent the shopper away and back. Storefront-only, like
67
- * `startCheckout`, and safe to call on every page load.
68
- */
69
- resumeCheckout: ResumeCheckout;
70
56
  addNonRevenueItem: AddNonRevenueItem;
71
57
  addCustomerNote: AddCustomerNote;
72
58
  removeCustomerNote: RemoveCustomerNote;
@@ -2,21 +2,20 @@
2
2
  * Pub/Sub Topics
3
3
  * Export all available topics and their types
4
4
  */
5
- export * from "./customers";
6
- export * from "./orders";
7
- export * from "./bookings";
8
- export * from "./refunds";
9
- export * from "./products";
10
- export * from "./cart";
11
- export * from "./payments";
12
- export * from "./checkout";
13
- export * from "./custom-tables";
14
- export * from "./print";
15
- export * from "./outlet";
16
- export * from "./station";
17
- export * from "./session";
18
- export * from "./users";
19
- export * from "./variants";
20
- export * from "./transactions";
21
- export * from "./categories";
22
- export * from "./attributes";
5
+ export * from './customers';
6
+ export * from './orders';
7
+ export * from './bookings';
8
+ export * from './refunds';
9
+ export * from './products';
10
+ export * from './cart';
11
+ export * from './payments';
12
+ export * from './custom-tables';
13
+ export * from './print';
14
+ export * from './outlet';
15
+ export * from './station';
16
+ export * from './session';
17
+ export * from './users';
18
+ export * from './variants';
19
+ export * from './transactions';
20
+ export * from './categories';
21
+ export * from './attributes';
@@ -2,21 +2,20 @@
2
2
  * Pub/Sub Topics
3
3
  * Export all available topics and their types
4
4
  */
5
- export * from "./customers";
6
- export * from "./orders";
7
- export * from "./bookings";
8
- export * from "./refunds";
9
- export * from "./products";
10
- export * from "./cart";
11
- export * from "./payments";
12
- export * from "./checkout";
13
- export * from "./custom-tables";
14
- export * from "./print";
15
- export * from "./outlet";
16
- export * from "./station";
17
- export * from "./session";
18
- export * from "./users";
19
- export * from "./variants";
20
- export * from "./transactions";
21
- export * from "./categories";
22
- export * from "./attributes";
5
+ export * from './customers';
6
+ export * from './orders';
7
+ export * from './bookings';
8
+ export * from './refunds';
9
+ export * from './products';
10
+ export * from './cart';
11
+ export * from './payments';
12
+ export * from './custom-tables';
13
+ export * from './print';
14
+ export * from './outlet';
15
+ export * from './station';
16
+ export * from './session';
17
+ export * from './users';
18
+ export * from './variants';
19
+ export * from './transactions';
20
+ export * from './categories';
21
+ export * from './attributes';
@@ -4,7 +4,6 @@ import { RefundsEventType, RefundsEventPayload } from "./refunds/types";
4
4
  import { ProductsEventType, ProductsEventPayload } from "./products/types";
5
5
  import { CartEventType, CartEventPayload } from "./cart/types";
6
6
  import { PaymentsEventType, PaymentsEventPayload } from "./payments/types";
7
- import { CheckoutEventType, CheckoutEventPayload } from "./checkout/types";
8
7
  import { SplitPaymentsEventType, SplitPaymentsEventPayload } from "./split-payments/types";
9
8
  import { CustomTablesEventPayload, CustomTablesEventType } from "./custom-tables/types";
10
9
  import { PrintEventType, PrintEventPayload } from "./print/types";
@@ -24,13 +23,6 @@ export interface TopicEventPayloadMap {
24
23
  products: Record<ProductsEventType, ProductsEventPayload>;
25
24
  cart: Record<CartEventType, CartEventPayload>;
26
25
  payments: Record<PaymentsEventType, PaymentsEventPayload>;
27
- /**
28
- * ONLINE checkout only (a published website), where the POS `payments`
29
- * topic never fires: `payments` reports a till tender settling in front of
30
- * a cashier, while a web shopper's outcome arrives asynchronously and can
31
- * only ever be an authorisation until the provider's webhook lands.
32
- */
33
- checkout: Record<CheckoutEventType, CheckoutEventPayload>;
34
26
  "split-payments": Record<SplitPaymentsEventType, SplitPaymentsEventPayload>;
35
27
  customTables: Record<CustomTablesEventType, CustomTablesEventPayload>;
36
28
  print: Record<PrintEventType, PrintEventPayload>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@final-commerce/command-frame",
3
- "version": "0.8.1-online.1",
3
+ "version": "0.9.0-preprod.1",
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.4.1-online.1"
60
+ "@final-commerce/common": "2.5.0-preprod.1"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@commitlint/cli": "^19.0.0",
@@ -1,6 +0,0 @@
1
- /**
2
- * Attach Checkout Contact action
3
- * Calls the attachCheckoutContact action on the parent window
4
- */
5
- import type { AttachCheckoutContact } from './types';
6
- export declare const attachCheckoutContact: AttachCheckoutContact;
@@ -1,8 +0,0 @@
1
- /**
2
- * Attach Checkout Contact action
3
- * Calls the attachCheckoutContact action on the parent window
4
- */
5
- import { commandFrameClient } from '../../client';
6
- export const attachCheckoutContact = async (params) => {
7
- return await commandFrameClient.call('attachCheckoutContact', params);
8
- };
@@ -1,15 +0,0 @@
1
- import type { AttachCheckoutContact } from './types';
2
- /**
3
- * Standalone mock of attaching contact to an online order.
4
- *
5
- * It mirrors the one REFUSAL the real command makes — a missing email — because
6
- * that is the mistake a builder actually hits, and a mock that accepted anything
7
- * would let a checkout screen look finished and lose receipts on the published
8
- * site.
9
- *
10
- * It does NOT mirror "no order to attach to". The real command answers
11
- * `attached: false` there rather than throwing, precisely so a flow can call it
12
- * optimistically and still let the shopper pay; the mock always has a checkout
13
- * to attach to, so it reports `true`.
14
- */
15
- export declare const mockAttachCheckoutContact: AttachCheckoutContact;
@@ -1,22 +0,0 @@
1
- /**
2
- * Standalone mock of attaching contact to an online order.
3
- *
4
- * It mirrors the one REFUSAL the real command makes — a missing email — because
5
- * that is the mistake a builder actually hits, and a mock that accepted anything
6
- * would let a checkout screen look finished and lose receipts on the published
7
- * site.
8
- *
9
- * It does NOT mirror "no order to attach to". The real command answers
10
- * `attached: false` there rather than throwing, precisely so a flow can call it
11
- * optimistically and still let the shopper pay; the mock always has a checkout
12
- * to attach to, so it reports `true`.
13
- */
14
- export const mockAttachCheckoutContact = async (params) => {
15
- console.log('[Mock] attachCheckoutContact called', params);
16
- if (!params)
17
- throw new Error('Params required');
18
- if (!params.email || !params.email.trim()) {
19
- throw new Error('attachCheckoutContact: email is required — it is where the receipt goes');
20
- }
21
- return { attached: true, timestamp: new Date().toISOString() };
22
- };