@final-commerce/command-frame 0.14.1-online.3 → 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.
Files changed (94) hide show
  1. package/README.md +10 -0
  2. package/dist/CommonTypes.d.ts +2 -1
  3. package/dist/actions/add-booking-to-cart/mock.js +1 -1
  4. package/dist/actions/add-booking-to-cart/types.d.ts +33 -4
  5. package/dist/actions/attach-checkout-contact/types.d.ts +2 -14
  6. package/dist/actions/delete-custom-table-data/mock.js +2 -0
  7. package/dist/actions/get-active-user/mock.js +3 -1
  8. package/dist/actions/get-booking-rental-ends/action.d.ts +6 -0
  9. package/dist/actions/get-booking-rental-ends/action.js +8 -0
  10. package/dist/actions/get-booking-rental-ends/mock.d.ts +2 -0
  11. package/dist/actions/get-booking-rental-ends/mock.js +6 -0
  12. package/dist/actions/get-booking-rental-ends/types.d.ts +31 -0
  13. package/dist/actions/get-booking-rental-ends/types.js +1 -0
  14. package/dist/actions/get-cash-change/action.d.ts +2 -0
  15. package/dist/actions/get-cash-change/action.js +8 -0
  16. package/dist/actions/get-cash-change/mock.d.ts +2 -0
  17. package/dist/actions/get-cash-change/mock.js +6 -0
  18. package/dist/actions/get-cash-change/types.d.ts +23 -0
  19. package/dist/actions/get-cash-change/types.js +1 -0
  20. package/dist/actions/get-checkout-status/types.d.ts +0 -9
  21. package/dist/actions/get-custom-table-data/mock.d.ts +5 -0
  22. package/dist/actions/get-custom-table-data/mock.js +16 -27
  23. package/dist/actions/get-orders-summary/action.d.ts +2 -0
  24. package/dist/actions/get-orders-summary/action.js +5 -0
  25. package/dist/actions/get-orders-summary/mock.d.ts +2 -0
  26. package/dist/actions/get-orders-summary/mock.js +5 -0
  27. package/dist/actions/get-orders-summary/types.d.ts +24 -0
  28. package/dist/actions/get-orders-summary/types.js +1 -0
  29. package/dist/actions/hold-booking/mock.d.ts +1 -0
  30. package/dist/actions/hold-booking/mock.js +27 -13
  31. package/dist/actions/hold-booking/types.d.ts +35 -6
  32. package/dist/actions/partial-payment/types.d.ts +5 -0
  33. package/dist/actions/process-partial-refund/mock.js +5 -0
  34. package/dist/actions/tap-to-pay-payment/mock.js +2 -1
  35. package/dist/actions/terminal-payment/mock.js +2 -1
  36. package/dist/actions/upsert-custom-table-data/mock.d.ts +6 -0
  37. package/dist/actions/upsert-custom-table-data/mock.js +25 -9
  38. package/dist/demo/database.d.ts +16 -0
  39. package/dist/demo/database.js +18 -2
  40. package/dist/demo/mocks/custom-tables.d.ts +4 -1
  41. package/dist/demo/mocks/custom-tables.js +1 -0
  42. package/dist/index.d.ts +6 -16
  43. package/dist/index.js +6 -17
  44. package/dist/projects/render/mocks.js +6 -16
  45. package/dist/projects/render/types.d.ts +4 -10
  46. package/package.json +2 -2
  47. package/dist/actions/get-address-details/action.d.ts +0 -6
  48. package/dist/actions/get-address-details/action.js +0 -8
  49. package/dist/actions/get-address-details/mock.d.ts +0 -2
  50. package/dist/actions/get-address-details/mock.js +0 -7
  51. package/dist/actions/get-address-details/types.d.ts +0 -22
  52. package/dist/actions/get-address-details/types.js +0 -3
  53. package/dist/actions/get-shopper-account/action.d.ts +0 -6
  54. package/dist/actions/get-shopper-account/action.js +0 -8
  55. package/dist/actions/get-shopper-account/mock.d.ts +0 -3
  56. package/dist/actions/get-shopper-account/mock.js +0 -12
  57. package/dist/actions/get-shopper-account/types.d.ts +0 -46
  58. package/dist/actions/get-shopper-account/types.js +0 -6
  59. package/dist/actions/get-shopper-order/action.d.ts +0 -6
  60. package/dist/actions/get-shopper-order/action.js +0 -8
  61. package/dist/actions/get-shopper-order/mock.d.ts +0 -2
  62. package/dist/actions/get-shopper-order/mock.js +0 -24
  63. package/dist/actions/get-shopper-order/types.d.ts +0 -32
  64. package/dist/actions/get-shopper-order/types.js +0 -6
  65. package/dist/actions/get-shopper-orders/action.d.ts +0 -6
  66. package/dist/actions/get-shopper-orders/action.js +0 -8
  67. package/dist/actions/get-shopper-orders/mock.d.ts +0 -2
  68. package/dist/actions/get-shopper-orders/mock.js +0 -18
  69. package/dist/actions/get-shopper-orders/types.d.ts +0 -29
  70. package/dist/actions/get-shopper-orders/types.js +0 -6
  71. package/dist/actions/request-shopper-code/action.d.ts +0 -6
  72. package/dist/actions/request-shopper-code/action.js +0 -8
  73. package/dist/actions/request-shopper-code/mock.d.ts +0 -2
  74. package/dist/actions/request-shopper-code/mock.js +0 -4
  75. package/dist/actions/request-shopper-code/types.d.ts +0 -17
  76. package/dist/actions/request-shopper-code/types.js +0 -6
  77. package/dist/actions/search-addresses/action.d.ts +0 -6
  78. package/dist/actions/search-addresses/action.js +0 -8
  79. package/dist/actions/search-addresses/mock.d.ts +0 -3
  80. package/dist/actions/search-addresses/mock.js +0 -24
  81. package/dist/actions/search-addresses/types.d.ts +0 -31
  82. package/dist/actions/search-addresses/types.js +0 -5
  83. package/dist/actions/sign-in-shopper/action.d.ts +0 -6
  84. package/dist/actions/sign-in-shopper/action.js +0 -8
  85. package/dist/actions/sign-in-shopper/mock.d.ts +0 -2
  86. package/dist/actions/sign-in-shopper/mock.js +0 -7
  87. package/dist/actions/sign-in-shopper/types.d.ts +0 -19
  88. package/dist/actions/sign-in-shopper/types.js +0 -6
  89. package/dist/actions/sign-out-shopper/action.d.ts +0 -6
  90. package/dist/actions/sign-out-shopper/action.js +0 -8
  91. package/dist/actions/sign-out-shopper/mock.d.ts +0 -2
  92. package/dist/actions/sign-out-shopper/mock.js +0 -4
  93. package/dist/actions/sign-out-shopper/types.d.ts +0 -7
  94. package/dist/actions/sign-out-shopper/types.js +0 -6
@@ -1,32 +0,0 @@
1
- import type { ShopperOrderView } from '../get-shopper-orders/types';
2
- export interface ShopperOrderItemView {
3
- name: string;
4
- /** e.g. "Slate", or null */
5
- variant: string | null;
6
- quantity: number;
7
- totalLabel: string;
8
- }
9
- export interface ShopperOrderDetailView extends ShopperOrderView {
10
- items: ShopperOrderItemView[];
11
- /** Subtotal, Discount, Tax, Shipping, Refunded, Total: only the ones that apply. */
12
- totals: {
13
- label: string;
14
- amountLabel: string;
15
- }[];
16
- /** "Visa •••• 4242", or null */
17
- paidWithLabel: string | null;
18
- /** "Pickup at Water St.", "Shipping", or null */
19
- deliveryLabel: string | null;
20
- /** "Return requested Nov 3, 2026", or null */
21
- returnLabel: string | null;
22
- }
23
- export interface GetShopperOrderParams {
24
- orderId: string;
25
- }
26
- export interface GetShopperOrderResponse {
27
- success: boolean;
28
- order?: ShopperOrderDetailView;
29
- reason?: string;
30
- }
31
- /** One of the shopper's orders at this store. */
32
- export type GetShopperOrder = (params: GetShopperOrderParams) => Promise<GetShopperOrderResponse>;
@@ -1,6 +0,0 @@
1
- // The shopper account on a store's website (My Account's store-scoped twin): sign in or sign up
2
- // with a code by email or text, see this store's orders. Served ONLY by the storefront runtime; on a
3
- // register it does not exist. Every value comes back READY TO DISPLAY (the runtime formats money,
4
- // dates and labels), so a flow shows it as it is and computes nothing. Failures resolve with
5
- // `success: false` and a `reason` written for the shopper; these never throw.
6
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * getShopperOrders action
3
- * Calls the getShopperOrders action on the parent window
4
- */
5
- import type { GetShopperOrders } from './types';
6
- export declare const getShopperOrders: GetShopperOrders;
@@ -1,8 +0,0 @@
1
- /**
2
- * getShopperOrders action
3
- * Calls the getShopperOrders action on the parent window
4
- */
5
- import { commandFrameClient } from '../../client';
6
- export const getShopperOrders = async (params) => {
7
- return await commandFrameClient.call('getShopperOrders', params ?? {});
8
- };
@@ -1,2 +0,0 @@
1
- import type { GetShopperOrders } from './types';
2
- export declare const mockGetShopperOrders: GetShopperOrders;
@@ -1,18 +0,0 @@
1
- export const mockGetShopperOrders = async () => {
2
- console.log('[Mock] getShopperOrders called');
3
- return {
4
- success: true,
5
- orders: [
6
- {
7
- orderId: '6a2f1c7b1e35f9a4c67a1010',
8
- receiptId: '#1042',
9
- placedAtLabel: 'Nov 1, 2026',
10
- status: 'paid',
11
- statusLabel: 'Paid',
12
- totalLabel: '$42.50',
13
- itemsLabel: '3 items',
14
- },
15
- ],
16
- nextCursor: null,
17
- };
18
- };
@@ -1,29 +0,0 @@
1
- import type { ShopperOrderStatus } from '@final-commerce/common';
2
- /** One order row, ready to display. */
3
- export interface ShopperOrderView {
4
- orderId: string;
5
- receiptId: string;
6
- /** e.g. "Nov 1, 2026" */
7
- placedAtLabel: string;
8
- /** For styling only: the label is what the shopper reads. */
9
- status: ShopperOrderStatus;
10
- /** "Paid", "Refunded", "Partially refunded", "Cancelled" */
11
- statusLabel: string;
12
- /** "$42.50" */
13
- totalLabel: string;
14
- /** "3 items" */
15
- itemsLabel: string;
16
- }
17
- export interface GetShopperOrdersParams {
18
- /** From the previous page's `nextCursor`. */
19
- cursor?: string;
20
- }
21
- export interface GetShopperOrdersResponse {
22
- success: boolean;
23
- /** This store's orders placed with the shopper's verified emails, newest first. */
24
- orders: ShopperOrderView[];
25
- nextCursor: string | null;
26
- reason?: string;
27
- }
28
- /** The signed-in shopper's orders at this store. */
29
- export type GetShopperOrders = (params?: GetShopperOrdersParams) => Promise<GetShopperOrdersResponse>;
@@ -1,6 +0,0 @@
1
- // The shopper account on a store's website (My Account's store-scoped twin): sign in or sign up
2
- // with a code by email or text, see this store's orders. Served ONLY by the storefront runtime; on a
3
- // register it does not exist. Every value comes back READY TO DISPLAY (the runtime formats money,
4
- // dates and labels), so a flow shows it as it is and computes nothing. Failures resolve with
5
- // `success: false` and a `reason` written for the shopper; these never throw.
6
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * requestShopperCode action
3
- * Calls the requestShopperCode action on the parent window
4
- */
5
- import type { RequestShopperCode } from './types';
6
- export declare const requestShopperCode: RequestShopperCode;
@@ -1,8 +0,0 @@
1
- /**
2
- * requestShopperCode action
3
- * Calls the requestShopperCode action on the parent window
4
- */
5
- import { commandFrameClient } from '../../client';
6
- export const requestShopperCode = async (params) => {
7
- return await commandFrameClient.call('requestShopperCode', params ?? {});
8
- };
@@ -1,2 +0,0 @@
1
- import type { RequestShopperCode } from './types';
2
- export declare const mockRequestShopperCode: RequestShopperCode;
@@ -1,4 +0,0 @@
1
- export const mockRequestShopperCode = async (params) => {
2
- console.log('[Mock] requestShopperCode called', params);
3
- return { success: true, message: `We sent a 6-digit code to ${params.email ?? params.phone ?? 'your email'}` };
4
- };
@@ -1,17 +0,0 @@
1
- /**
2
- * Where the code goes: an `email`, or a `phone` (a text message; any common spelling, the runtime
3
- * makes it E.164 with +1 when no country is given). Give one, not both. Give neither right after a
4
- * guest checkout to send it to the email that checkout used ("Email me a code" on the confirmation).
5
- */
6
- export interface RequestShopperCodeParams {
7
- email?: string;
8
- phone?: string;
9
- }
10
- export interface RequestShopperCodeResponse {
11
- success: boolean;
12
- /** "We sent a 6-digit code to s…@example.com" (or "…by text to ••• 0101"). Never says who has an account. */
13
- message?: string;
14
- reason?: string;
15
- }
16
- /** Send a 6-digit sign-in code by email or text. It works at this store only. Signing up is the same step. */
17
- export type RequestShopperCode = (params: RequestShopperCodeParams) => Promise<RequestShopperCodeResponse>;
@@ -1,6 +0,0 @@
1
- // The shopper account on a store's website (My Account's store-scoped twin): sign in or sign up
2
- // with a code by email or text, see this store's orders. Served ONLY by the storefront runtime; on a
3
- // register it does not exist. Every value comes back READY TO DISPLAY (the runtime formats money,
4
- // dates and labels), so a flow shows it as it is and computes nothing. Failures resolve with
5
- // `success: false` and a `reason` written for the shopper; these never throw.
6
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * searchAddresses action
3
- * Calls the searchAddresses action on the parent window
4
- */
5
- import type { SearchAddresses } from './types';
6
- export declare const searchAddresses: SearchAddresses;
@@ -1,8 +0,0 @@
1
- /**
2
- * searchAddresses action
3
- * Calls the searchAddresses action on the parent window
4
- */
5
- import { commandFrameClient } from '../../client';
6
- export const searchAddresses = async (params) => {
7
- return await commandFrameClient.call('searchAddresses', params);
8
- };
@@ -1,3 +0,0 @@
1
- import type { SearchAddresses } from './types';
2
- /** Standalone mock: two Water Street addresses for anything typed. */
3
- export declare const mockSearchAddresses: SearchAddresses;
@@ -1,24 +0,0 @@
1
- /** Standalone mock: two Water Street addresses for anything typed. */
2
- export const mockSearchAddresses = async (params) => {
3
- console.log('[Mock] searchAddresses called', params);
4
- if (params.query.trim().length < 3)
5
- return { success: true, available: true, suggestions: [] };
6
- return {
7
- success: true,
8
- available: true,
9
- suggestions: [
10
- {
11
- id: 'mock-place-1',
12
- label: "12 Water St, St. John's, NL, Canada",
13
- main: '12 Water St',
14
- secondary: "St. John's, NL, Canada",
15
- },
16
- {
17
- id: 'mock-place-2',
18
- label: "120 Water St, St. John's, NL, Canada",
19
- main: '120 Water St',
20
- secondary: "St. John's, NL, Canada",
21
- },
22
- ],
23
- };
24
- };
@@ -1,31 +0,0 @@
1
- /** One line to show in the dropdown. Pass its `id` to getAddressDetails when the shopper picks it. */
2
- export interface AddressSuggestion {
3
- id: string;
4
- /** The whole line: "12 Water St, St. John's, NL, Canada". */
5
- label: string;
6
- /** The street part, for a two-line row: "12 Water St". */
7
- main: string;
8
- /** The rest: "St. John's, NL, Canada". */
9
- secondary: string;
10
- }
11
- export interface SearchAddressesParams {
12
- /** What the shopper typed so far. Under 3 characters answers no suggestions without a lookup. */
13
- query: string;
14
- /** ISO 3166-1 alpha-2. Defaults to the store's own country. */
15
- country?: string;
16
- /** Language of the suggestions, e.g. `fr`. */
17
- language?: string;
18
- }
19
- export interface SearchAddressesResponse {
20
- success: boolean;
21
- suggestions: AddressSuggestion[];
22
- /** false when this site has no address lookup: keep the plain fields and stop asking. */
23
- available: boolean;
24
- reason?: string;
25
- }
26
- /**
27
- * Addresses matching what the shopper typed, for an autocomplete dropdown. Call it as they type
28
- * (wait ~250 ms after the last keystroke); the runtime groups the searches and the pick into one
29
- * lookup session itself.
30
- */
31
- export type SearchAddresses = (params: SearchAddressesParams) => Promise<SearchAddressesResponse>;
@@ -1,5 +0,0 @@
1
- // Address autocomplete for a store website's checkout: what the shopper typed in, matching
2
- // addresses out, then the picked one as a full address (getAddressDetails). Served ONLY by the
3
- // storefront runtime. Failures resolve with `success: false` and a `reason`; these never throw, and
4
- // when lookup is not available the flow simply keeps its plain address fields.
5
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * signInShopper action
3
- * Calls the signInShopper action on the parent window
4
- */
5
- import type { SignInShopper } from './types';
6
- export declare const signInShopper: SignInShopper;
@@ -1,8 +0,0 @@
1
- /**
2
- * signInShopper action
3
- * Calls the signInShopper action on the parent window
4
- */
5
- import { commandFrameClient } from '../../client';
6
- export const signInShopper = async (params) => {
7
- return await commandFrameClient.call('signInShopper', params ?? {});
8
- };
@@ -1,2 +0,0 @@
1
- import type { SignInShopper } from './types';
2
- export declare const mockSignInShopper: SignInShopper;
@@ -1,7 +0,0 @@
1
- export const mockSignInShopper = async (params) => {
2
- console.log('[Mock] signInShopper called', params);
3
- const email = params.email ?? null;
4
- return params.code === '000000'
5
- ? { success: false, reason: 'That code is wrong' }
6
- : { success: true, shopper: { name: email?.split('@')[0] ?? '', email, phone: params.phone ?? null } };
7
- };
@@ -1,19 +0,0 @@
1
- import type { ShopperAccountView } from '../get-shopper-account/types';
2
- /** The same `email` or `phone` the code was sent to (or neither, after a guest checkout), and the code. */
3
- export interface SignInShopperParams {
4
- email?: string;
5
- phone?: string;
6
- code: string;
7
- }
8
- export interface SignInShopperResponse {
9
- success: boolean;
10
- shopper?: ShopperAccountView;
11
- /** "That code is wrong", "Too many tries, get a new code", ... */
12
- reason?: string;
13
- }
14
- /**
15
- * Sign in (or up) with the code. The session is kept for this store only. Signing in fills the
16
- * checkout's contact and default address when they are empty, and the payment step then offers the
17
- * shopper's saved cards.
18
- */
19
- export type SignInShopper = (params: SignInShopperParams) => Promise<SignInShopperResponse>;
@@ -1,6 +0,0 @@
1
- // The shopper account on a store's website (My Account's store-scoped twin): sign in or sign up
2
- // with a code by email or text, see this store's orders. Served ONLY by the storefront runtime; on a
3
- // register it does not exist. Every value comes back READY TO DISPLAY (the runtime formats money,
4
- // dates and labels), so a flow shows it as it is and computes nothing. Failures resolve with
5
- // `success: false` and a `reason` written for the shopper; these never throw.
6
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * signOutShopper action
3
- * Calls the signOutShopper action on the parent window
4
- */
5
- import type { SignOutShopper } from './types';
6
- export declare const signOutShopper: SignOutShopper;
@@ -1,8 +0,0 @@
1
- /**
2
- * signOutShopper action
3
- * Calls the signOutShopper action on the parent window
4
- */
5
- import { commandFrameClient } from '../../client';
6
- export const signOutShopper = async (params) => {
7
- return await commandFrameClient.call('signOutShopper', params ?? {});
8
- };
@@ -1,2 +0,0 @@
1
- import type { SignOutShopper } from './types';
2
- export declare const mockSignOutShopper: SignOutShopper;
@@ -1,4 +0,0 @@
1
- export const mockSignOutShopper = async () => {
2
- console.log('[Mock] signOutShopper called');
3
- return { success: true };
4
- };
@@ -1,7 +0,0 @@
1
- export type SignOutShopperParams = Record<string, never>;
2
- export interface SignOutShopperResponse {
3
- success: boolean;
4
- reason?: string;
5
- }
6
- /** Ends this store's session on this device. */
7
- export type SignOutShopper = (params?: SignOutShopperParams) => Promise<SignOutShopperResponse>;
@@ -1,6 +0,0 @@
1
- // The shopper account on a store's website (My Account's store-scoped twin): sign in or sign up
2
- // with a code by email or text, see this store's orders. Served ONLY by the storefront runtime; on a
3
- // register it does not exist. Every value comes back READY TO DISPLAY (the runtime formats money,
4
- // dates and labels), so a flow shows it as it is and computes nothing. Failures resolve with
5
- // `success: false` and a `reason` written for the shopper; these never throw.
6
- export {};