@final-commerce/command-frame 0.14.1-online.2 → 0.15.0-staging.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 (86) hide show
  1. package/README.md +10 -0
  2. package/dist/actions/add-booking-to-cart/mock.js +1 -1
  3. package/dist/actions/add-booking-to-cart/types.d.ts +33 -4
  4. package/dist/actions/attach-checkout-contact/types.d.ts +2 -14
  5. package/dist/actions/delete-custom-table-data/mock.js +2 -0
  6. package/dist/actions/get-active-user/mock.js +3 -1
  7. package/dist/actions/get-cash-change/action.d.ts +2 -0
  8. package/dist/actions/get-cash-change/action.js +8 -0
  9. package/dist/actions/get-cash-change/mock.d.ts +2 -0
  10. package/dist/actions/get-cash-change/mock.js +6 -0
  11. package/dist/actions/get-cash-change/types.d.ts +23 -0
  12. package/dist/actions/get-cash-change/types.js +1 -0
  13. package/dist/actions/get-checkout-status/types.d.ts +0 -9
  14. package/dist/actions/get-custom-table-data/mock.d.ts +5 -0
  15. package/dist/actions/get-custom-table-data/mock.js +16 -27
  16. package/dist/actions/get-orders-summary/action.d.ts +2 -0
  17. package/dist/actions/get-orders-summary/action.js +5 -0
  18. package/dist/actions/get-orders-summary/mock.d.ts +2 -0
  19. package/dist/actions/get-orders-summary/mock.js +5 -0
  20. package/dist/actions/get-orders-summary/types.d.ts +24 -0
  21. package/dist/actions/get-orders-summary/types.js +1 -0
  22. package/dist/actions/hold-booking/mock.js +27 -13
  23. package/dist/actions/hold-booking/types.d.ts +35 -6
  24. package/dist/actions/partial-payment/types.d.ts +5 -0
  25. package/dist/actions/process-partial-refund/mock.js +5 -0
  26. package/dist/actions/tap-to-pay-payment/mock.js +2 -1
  27. package/dist/actions/terminal-payment/mock.js +2 -1
  28. package/dist/actions/upsert-custom-table-data/mock.d.ts +6 -0
  29. package/dist/actions/upsert-custom-table-data/mock.js +25 -9
  30. package/dist/demo/database.d.ts +16 -0
  31. package/dist/demo/database.js +18 -2
  32. package/dist/demo/mocks/custom-tables.d.ts +4 -1
  33. package/dist/demo/mocks/custom-tables.js +1 -0
  34. package/dist/index.d.ts +4 -16
  35. package/dist/index.js +4 -17
  36. package/dist/projects/render/mocks.js +4 -16
  37. package/dist/projects/render/types.d.ts +3 -10
  38. package/package.json +2 -2
  39. package/dist/actions/get-address-details/action.d.ts +0 -6
  40. package/dist/actions/get-address-details/action.js +0 -8
  41. package/dist/actions/get-address-details/mock.d.ts +0 -2
  42. package/dist/actions/get-address-details/mock.js +0 -7
  43. package/dist/actions/get-address-details/types.d.ts +0 -22
  44. package/dist/actions/get-address-details/types.js +0 -3
  45. package/dist/actions/get-shopper-account/action.d.ts +0 -6
  46. package/dist/actions/get-shopper-account/action.js +0 -8
  47. package/dist/actions/get-shopper-account/mock.d.ts +0 -3
  48. package/dist/actions/get-shopper-account/mock.js +0 -12
  49. package/dist/actions/get-shopper-account/types.d.ts +0 -46
  50. package/dist/actions/get-shopper-account/types.js +0 -6
  51. package/dist/actions/get-shopper-order/action.d.ts +0 -6
  52. package/dist/actions/get-shopper-order/action.js +0 -8
  53. package/dist/actions/get-shopper-order/mock.d.ts +0 -2
  54. package/dist/actions/get-shopper-order/mock.js +0 -24
  55. package/dist/actions/get-shopper-order/types.d.ts +0 -32
  56. package/dist/actions/get-shopper-order/types.js +0 -6
  57. package/dist/actions/get-shopper-orders/action.d.ts +0 -6
  58. package/dist/actions/get-shopper-orders/action.js +0 -8
  59. package/dist/actions/get-shopper-orders/mock.d.ts +0 -2
  60. package/dist/actions/get-shopper-orders/mock.js +0 -18
  61. package/dist/actions/get-shopper-orders/types.d.ts +0 -29
  62. package/dist/actions/get-shopper-orders/types.js +0 -6
  63. package/dist/actions/request-shopper-code/action.d.ts +0 -6
  64. package/dist/actions/request-shopper-code/action.js +0 -8
  65. package/dist/actions/request-shopper-code/mock.d.ts +0 -2
  66. package/dist/actions/request-shopper-code/mock.js +0 -4
  67. package/dist/actions/request-shopper-code/types.d.ts +0 -17
  68. package/dist/actions/request-shopper-code/types.js +0 -6
  69. package/dist/actions/search-addresses/action.d.ts +0 -6
  70. package/dist/actions/search-addresses/action.js +0 -8
  71. package/dist/actions/search-addresses/mock.d.ts +0 -3
  72. package/dist/actions/search-addresses/mock.js +0 -24
  73. package/dist/actions/search-addresses/types.d.ts +0 -31
  74. package/dist/actions/search-addresses/types.js +0 -5
  75. package/dist/actions/sign-in-shopper/action.d.ts +0 -6
  76. package/dist/actions/sign-in-shopper/action.js +0 -8
  77. package/dist/actions/sign-in-shopper/mock.d.ts +0 -2
  78. package/dist/actions/sign-in-shopper/mock.js +0 -7
  79. package/dist/actions/sign-in-shopper/types.d.ts +0 -19
  80. package/dist/actions/sign-in-shopper/types.js +0 -6
  81. package/dist/actions/sign-out-shopper/action.d.ts +0 -6
  82. package/dist/actions/sign-out-shopper/action.js +0 -8
  83. package/dist/actions/sign-out-shopper/mock.d.ts +0 -2
  84. package/dist/actions/sign-out-shopper/mock.js +0 -4
  85. package/dist/actions/sign-out-shopper/types.d.ts +0 -7
  86. package/dist/actions/sign-out-shopper/types.js +0 -6
@@ -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 {};