@final-commerce/command-frame 0.11.1-online.1 → 0.12.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 (161) hide show
  1. package/dist/CommonTypes.d.ts +1 -21
  2. package/dist/actions/get-current-cart/mock.js +0 -3
  3. package/dist/actions/get-current-cart/types.d.ts +0 -6
  4. package/dist/actions/get-orders/action.d.ts +1 -1
  5. package/dist/actions/get-orders/action.js +2 -2
  6. package/dist/actions/get-orders/mock.d.ts +1 -1
  7. package/dist/actions/get-orders/mock.js +19 -74
  8. package/dist/actions/get-orders/types.d.ts +2 -33
  9. package/dist/actions/get-outlets/action.js +2 -2
  10. package/dist/actions/get-outlets/mock.d.ts +0 -12
  11. package/dist/actions/get-outlets/mock.js +4 -28
  12. package/dist/actions/get-outlets/types.d.ts +1 -19
  13. package/dist/actions/get-product-modifier-selections/mock.js +0 -7
  14. package/dist/actions/get-product-modifier-selections/types.d.ts +0 -4
  15. package/dist/actions/get-products/types.d.ts +8 -8
  16. package/dist/actions/get-refund-plan/mockRows.js +1 -1
  17. package/dist/actions/get-refund-plan/types.d.ts +6 -9
  18. package/dist/actions/get-remaining-refundable-quantities/mock.js +0 -1
  19. package/dist/actions/get-remaining-refundable-quantities/types.d.ts +0 -5
  20. package/dist/actions/process-partial-refund/types.d.ts +1 -1
  21. package/dist/actions/resume-parked-order/mock.d.ts +0 -5
  22. package/dist/actions/resume-parked-order/mock.js +24 -25
  23. package/dist/actions/void-order/mock.js +7 -17
  24. package/dist/actions/void-order/types.d.ts +2 -6
  25. package/dist/common-types/order-state.d.ts +1 -20
  26. package/dist/demo/database.d.ts +0 -4
  27. package/dist/demo/database.js +0 -29
  28. package/dist/index.d.ts +1 -41
  29. package/dist/index.js +0 -39
  30. package/dist/projects/render/mocks.js +0 -40
  31. package/dist/projects/render/types.d.ts +1 -33
  32. package/dist/pubsub/topics/index.d.ts +17 -18
  33. package/dist/pubsub/topics/index.js +17 -18
  34. package/dist/pubsub/topics/types.d.ts +0 -8
  35. package/package.json +2 -2
  36. package/dist/actions/assign-order-user/action.d.ts +0 -6
  37. package/dist/actions/assign-order-user/action.js +0 -8
  38. package/dist/actions/assign-order-user/mock.d.ts +0 -2
  39. package/dist/actions/assign-order-user/mock.js +0 -30
  40. package/dist/actions/assign-order-user/types.d.ts +0 -15
  41. package/dist/actions/assign-order-user/types.js +0 -1
  42. package/dist/actions/attach-checkout-contact/action.d.ts +0 -6
  43. package/dist/actions/attach-checkout-contact/action.js +0 -8
  44. package/dist/actions/attach-checkout-contact/mock.d.ts +0 -15
  45. package/dist/actions/attach-checkout-contact/mock.js +0 -22
  46. package/dist/actions/attach-checkout-contact/types.d.ts +0 -35
  47. package/dist/actions/attach-checkout-contact/types.js +0 -16
  48. package/dist/actions/get-address-options/action.d.ts +0 -6
  49. package/dist/actions/get-address-options/action.js +0 -8
  50. package/dist/actions/get-address-options/mock.d.ts +0 -3
  51. package/dist/actions/get-address-options/mock.js +0 -15
  52. package/dist/actions/get-address-options/types.d.ts +0 -25
  53. package/dist/actions/get-address-options/types.js +0 -8
  54. package/dist/actions/get-checkout-status/action.d.ts +0 -6
  55. package/dist/actions/get-checkout-status/action.js +0 -8
  56. package/dist/actions/get-checkout-status/mock.d.ts +0 -3
  57. package/dist/actions/get-checkout-status/mock.js +0 -11
  58. package/dist/actions/get-checkout-status/types.d.ts +0 -20
  59. package/dist/actions/get-checkout-status/types.js +0 -12
  60. package/dist/actions/get-moto-config/action.d.ts +0 -6
  61. package/dist/actions/get-moto-config/action.js +0 -8
  62. package/dist/actions/get-moto-config/mock.d.ts +0 -7
  63. package/dist/actions/get-moto-config/mock.js +0 -9
  64. package/dist/actions/get-moto-config/types.d.ts +0 -34
  65. package/dist/actions/get-moto-config/types.js +0 -5
  66. package/dist/actions/get-order-statuses/action.d.ts +0 -6
  67. package/dist/actions/get-order-statuses/action.js +0 -8
  68. package/dist/actions/get-order-statuses/mock.d.ts +0 -2
  69. package/dist/actions/get-order-statuses/mock.js +0 -5
  70. package/dist/actions/get-order-statuses/types.d.ts +0 -8
  71. package/dist/actions/get-order-statuses/types.js +0 -1
  72. package/dist/actions/get-shipping-options/action.d.ts +0 -6
  73. package/dist/actions/get-shipping-options/action.js +0 -8
  74. package/dist/actions/get-shipping-options/mock.d.ts +0 -3
  75. package/dist/actions/get-shipping-options/mock.js +0 -15
  76. package/dist/actions/get-shipping-options/types.d.ts +0 -43
  77. package/dist/actions/get-shipping-options/types.js +0 -1
  78. package/dist/actions/record-external-payment/action.d.ts +0 -6
  79. package/dist/actions/record-external-payment/action.js +0 -8
  80. package/dist/actions/record-external-payment/mock.d.ts +0 -2
  81. package/dist/actions/record-external-payment/mock.js +0 -36
  82. package/dist/actions/record-external-payment/types.d.ts +0 -37
  83. package/dist/actions/record-external-payment/types.js +0 -1
  84. package/dist/actions/release-from-cart/action.d.ts +0 -6
  85. package/dist/actions/release-from-cart/action.js +0 -8
  86. package/dist/actions/release-from-cart/mock.d.ts +0 -2
  87. package/dist/actions/release-from-cart/mock.js +0 -26
  88. package/dist/actions/release-from-cart/types.d.ts +0 -8
  89. package/dist/actions/release-from-cart/types.js +0 -1
  90. package/dist/actions/resume-checkout/action.d.ts +0 -6
  91. package/dist/actions/resume-checkout/action.js +0 -8
  92. package/dist/actions/resume-checkout/mock.d.ts +0 -16
  93. package/dist/actions/resume-checkout/mock.js +0 -51
  94. package/dist/actions/resume-checkout/types.d.ts +0 -59
  95. package/dist/actions/resume-checkout/types.js +0 -13
  96. package/dist/actions/resume-order/action.d.ts +0 -6
  97. package/dist/actions/resume-order/action.js +0 -8
  98. package/dist/actions/resume-order/mock.d.ts +0 -2
  99. package/dist/actions/resume-order/mock.js +0 -55
  100. package/dist/actions/resume-order/types.d.ts +0 -17
  101. package/dist/actions/resume-order/types.js +0 -1
  102. package/dist/actions/select-shipping-option/action.d.ts +0 -6
  103. package/dist/actions/select-shipping-option/action.js +0 -8
  104. package/dist/actions/select-shipping-option/mock.d.ts +0 -3
  105. package/dist/actions/select-shipping-option/mock.js +0 -31
  106. package/dist/actions/select-shipping-option/types.d.ts +0 -15
  107. package/dist/actions/select-shipping-option/types.js +0 -1
  108. package/dist/actions/set-order-address/action.d.ts +0 -6
  109. package/dist/actions/set-order-address/action.js +0 -8
  110. package/dist/actions/set-order-address/mock.d.ts +0 -7
  111. package/dist/actions/set-order-address/mock.js +0 -29
  112. package/dist/actions/set-order-address/types.d.ts +0 -19
  113. package/dist/actions/set-order-address/types.js +0 -1
  114. package/dist/actions/set-order-metadata/action.d.ts +0 -6
  115. package/dist/actions/set-order-metadata/action.js +0 -8
  116. package/dist/actions/set-order-metadata/mock.d.ts +0 -5
  117. package/dist/actions/set-order-metadata/mock.js +0 -38
  118. package/dist/actions/set-order-metadata/types.d.ts +0 -20
  119. package/dist/actions/set-order-metadata/types.js +0 -1
  120. package/dist/actions/set-order-status/action.d.ts +0 -6
  121. package/dist/actions/set-order-status/action.js +0 -8
  122. package/dist/actions/set-order-status/mock.d.ts +0 -3
  123. package/dist/actions/set-order-status/mock.js +0 -44
  124. package/dist/actions/set-order-status/types.d.ts +0 -25
  125. package/dist/actions/set-order-status/types.js +0 -1
  126. package/dist/actions/set-order-type/action.d.ts +0 -6
  127. package/dist/actions/set-order-type/action.js +0 -8
  128. package/dist/actions/set-order-type/mock.d.ts +0 -3
  129. package/dist/actions/set-order-type/mock.js +0 -27
  130. package/dist/actions/set-order-type/types.d.ts +0 -17
  131. package/dist/actions/set-order-type/types.js +0 -1
  132. package/dist/actions/set-outlet/action.d.ts +0 -6
  133. package/dist/actions/set-outlet/action.js +0 -8
  134. package/dist/actions/set-outlet/mock.d.ts +0 -13
  135. package/dist/actions/set-outlet/mock.js +0 -24
  136. package/dist/actions/set-outlet/types.d.ts +0 -31
  137. package/dist/actions/set-outlet/types.js +0 -21
  138. package/dist/actions/set-scheduled-for/action.d.ts +0 -6
  139. package/dist/actions/set-scheduled-for/action.js +0 -8
  140. package/dist/actions/set-scheduled-for/mock.d.ts +0 -4
  141. package/dist/actions/set-scheduled-for/mock.js +0 -45
  142. package/dist/actions/set-scheduled-for/types.d.ts +0 -22
  143. package/dist/actions/set-scheduled-for/types.js +0 -1
  144. package/dist/actions/start-checkout/action.d.ts +0 -6
  145. package/dist/actions/start-checkout/action.js +0 -8
  146. package/dist/actions/start-checkout/mock.d.ts +0 -16
  147. package/dist/actions/start-checkout/mock.js +0 -80
  148. package/dist/actions/start-checkout/types.d.ts +0 -90
  149. package/dist/actions/start-checkout/types.js +0 -10
  150. package/dist/demo/shipping.d.ts +0 -8
  151. package/dist/demo/shipping.js +0 -69
  152. package/dist/pubsub/topics/checkout/checkout-started/types.d.ts +0 -26
  153. package/dist/pubsub/topics/checkout/checkout-started/types.js +0 -1
  154. package/dist/pubsub/topics/checkout/index.d.ts +0 -7
  155. package/dist/pubsub/topics/checkout/index.js +0 -28
  156. package/dist/pubsub/topics/checkout/payment-completed/types.d.ts +0 -31
  157. package/dist/pubsub/topics/checkout/payment-completed/types.js +0 -1
  158. package/dist/pubsub/topics/checkout/payment-failed/types.d.ts +0 -20
  159. package/dist/pubsub/topics/checkout/payment-failed/types.js +0 -1
  160. package/dist/pubsub/topics/checkout/types.d.ts +0 -12
  161. package/dist/pubsub/topics/checkout/types.js +0 -8
@@ -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.11.1-online.1",
3
+ "version": "0.12.0-staging.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.8.1-online.1"
60
+ "@final-commerce/common": "2.9.0-staging.1"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@commitlint/cli": "^19.0.0",
@@ -1,6 +0,0 @@
1
- /**
2
- * Assign order user action
3
- * Calls the assignOrderUser action on the parent window
4
- */
5
- import type { AssignOrderUser } from './types';
6
- export declare const assignOrderUser: AssignOrderUser;
@@ -1,8 +0,0 @@
1
- /**
2
- * Assign order user action
3
- * Calls the assignOrderUser action on the parent window
4
- */
5
- import { commandFrameClient } from '../../client';
6
- export const assignOrderUser = async (params) => {
7
- return await commandFrameClient.call('assignOrderUser', params);
8
- };
@@ -1,2 +0,0 @@
1
- import type { AssignOrderUser } from './types';
2
- export declare const mockAssignOrderUser: AssignOrderUser;
@@ -1,30 +0,0 @@
1
- import { MOCK_ORDERS, MOCK_PARKED_ORDERS, MOCK_USERS, mockPublishEvent } from '../../demo/database';
2
- export const mockAssignOrderUser = async (params) => {
3
- console.log('[Mock] assignOrderUser called', params);
4
- if (!params?.orderId) {
5
- throw new Error('assignOrderUser: the demo has no live-cart order — pass an orderId');
6
- }
7
- if (params.userId !== null && typeof params.userId !== 'string') {
8
- throw new Error('assignOrderUser: userId must be a user id or null');
9
- }
10
- const order = [...MOCK_ORDERS, ...MOCK_PARKED_ORDERS].find((o) => o._id === params.orderId);
11
- if (!order) {
12
- throw new Error(`Order with ID ${params.orderId} not found`);
13
- }
14
- if (params.userId === null) {
15
- order.assignedUser = null;
16
- }
17
- else if (order.assignedUser?.userId !== params.userId) {
18
- if (!MOCK_USERS.some((u) => u.id === params.userId)) {
19
- throw new Error(`User with ID ${params.userId} not found`);
20
- }
21
- order.assignedUser = { userId: params.userId, assignedAt: new Date().toISOString() };
22
- }
23
- mockPublishEvent('orders', 'order-updated', { order });
24
- return {
25
- success: true,
26
- orderId: order._id,
27
- assignedUser: order.assignedUser ?? null,
28
- timestamp: new Date().toISOString(),
29
- };
30
- };
@@ -1,15 +0,0 @@
1
- import type { CFOrderAssignedUser } from '../../CommonTypes';
2
- export interface AssignOrderUserParams {
3
- /** Order to assign. Omit to target the live cart's order — it must already exist (parked, paid or transitioned). */
4
- orderId?: string;
5
- /** User to assign (e.g. the driver), or null to unassign. Replaces any current assignee. */
6
- userId: string | null;
7
- }
8
- export interface AssignOrderUserResponse {
9
- success: boolean;
10
- orderId: string;
11
- /** The order's assignee after the call; null when unassigned. */
12
- assignedUser: CFOrderAssignedUser | null;
13
- timestamp: string;
14
- }
15
- export type AssignOrderUser = (params: AssignOrderUserParams) => Promise<AssignOrderUserResponse>;
@@ -1 +0,0 @@
1
- export {};
@@ -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
- };
@@ -1,35 +0,0 @@
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 AttachCheckoutContactParams {
6
- email: string;
7
- name?: string;
8
- phone?: string;
9
- /** Defaults to the outlet the storefront booted against. */
10
- outletId?: string;
11
- }
12
- export interface AttachCheckoutContactResponse {
13
- /**
14
- * `false` means there was nothing to attach to — no checkout had been started
15
- * for this cart. It is NOT a failure to record the contact on an order that
16
- * exists, and it never means the shopper was charged.
17
- */
18
- attached: boolean;
19
- timestamp: string;
20
- }
21
- /**
22
- * Put the shopper's contact on the order `startCheckout` already created.
23
- *
24
- * Call it BEFORE paying, whenever the email is known — on blur, on submit, or
25
- * as the shopper leaves the contact step. It reuses the order's idempotency
26
- * key, so it updates that order rather than creating a second one.
27
- *
28
- * SAFE TO CALL TWICE. The server only ever ADDS contact to an order that has
29
- * none, so a later call cannot redirect a receipt that was already addressed.
30
- *
31
- * NEVER THROWS FOR A MISSING ORDER. Failing to record an email must not stop a
32
- * payment the shopper is trying to make, so the caller gets `attached: false`
33
- * and can carry on to pay.
34
- */
35
- export type AttachCheckoutContact = (params: AttachCheckoutContactParams) => Promise<AttachCheckoutContactResponse>;
@@ -1,16 +0,0 @@
1
- // Attach Checkout Contact Types
2
- //
3
- // The second half of the online checkout. `startCheckout` creates the order and
4
- // mounts the payment fields the moment a shopper ARRIVES; this puts their email
5
- // on that same order once they have typed it.
6
- //
7
- // WHY THESE ARE TWO COMMANDS. The card fields cannot render without a payment
8
- // session, a session needs a server-priced amount, and an amount needs an order.
9
- // So the order has to exist before the shopper has typed anything. Demanding an
10
- // email first is what forced the old "fill the form, then see the card fields"
11
- // checkout — and it also meant every cart edit minted a NEW order, because the
12
- // idempotency key moved with the cart.
13
- //
14
- // Served ONLY by the storefront runtime (a published website), like
15
- // `startCheckout` itself. On a register it does not exist.
16
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * GetAddressOptions action
3
- * Calls the getAddressOptions action on the parent window
4
- */
5
- import type { GetAddressOptions } from './types';
6
- export declare const getAddressOptions: GetAddressOptions;
@@ -1,8 +0,0 @@
1
- /**
2
- * GetAddressOptions action
3
- * Calls the getAddressOptions action on the parent window
4
- */
5
- import { commandFrameClient } from '../../client';
6
- export const getAddressOptions = async (params) => {
7
- return await commandFrameClient.call('getAddressOptions', params);
8
- };
@@ -1,3 +0,0 @@
1
- import type { GetAddressOptions } from './types';
2
- /** Standalone mock: the same country and province lists the runtime serves. The demo store is in Canada. */
3
- export declare const mockGetAddressOptions: GetAddressOptions;
@@ -1,15 +0,0 @@
1
- import { CANADA_PROVINCES, listCountries } from '@final-commerce/common';
2
- /** Standalone mock: the same country and province lists the runtime serves. The demo store is in Canada. */
3
- export const mockGetAddressOptions = async (params) => {
4
- console.log('[Mock] getAddressOptions called', params);
5
- const french = params?.locale?.toLowerCase().startsWith('fr') ?? false;
6
- const provinces = CANADA_PROVINCES.map((p) => ({ code: p.code, name: french ? p.nameFr : p.name }));
7
- return {
8
- countries: listCountries(params?.locale ?? 'en').map((c) => ({
9
- ...c,
10
- provinces: c.code === 'CA' ? provinces : [],
11
- })),
12
- defaultCountry: 'CA',
13
- timestamp: new Date().toISOString(),
14
- };
15
- };
@@ -1,25 +0,0 @@
1
- export interface AddressProvinceOption {
2
- /** Province code, e.g. `QC`. This is what goes in the address's `state`. */
3
- code: string;
4
- /** In the requested locale where we have it (English or French). */
5
- name: string;
6
- }
7
- export interface AddressCountryOption {
8
- /** ISO 3166-1 alpha-2, e.g. `CA`. This is what goes in the address's `country`. */
9
- code: string;
10
- name: string;
11
- /** Empty when the country has no province list; the form then shows a free text field. */
12
- provinces: AddressProvinceOption[];
13
- }
14
- export interface GetAddressOptionsParams {
15
- /** BCP 47 locale for the names, e.g. `fr-CA`. Defaults to `en`. */
16
- locale?: string;
17
- }
18
- export interface GetAddressOptionsResponse {
19
- /** Sorted by name in the requested locale. */
20
- countries: AddressCountryOption[];
21
- /** The store's own country, to preselect. Null when it isn't known. */
22
- defaultCountry: string | null;
23
- timestamp: string;
24
- }
25
- export type GetAddressOptions = (params?: GetAddressOptionsParams) => Promise<GetAddressOptionsResponse>;
@@ -1,8 +0,0 @@
1
- // Get Address Options Types
2
- //
3
- // What an address form offers: countries, and the provinces of the countries that
4
- // have them (Canada today). A flow renders these as dropdowns and keeps no list of
5
- // its own, so what the shopper picks is always a code the shipping rules match.
6
- //
7
- // Served by the till and by the storefront runtime.
8
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * Get Checkout Status action
3
- * Calls the getCheckoutStatus action on the parent window
4
- */
5
- import type { GetCheckoutStatus } from './types';
6
- export declare const getCheckoutStatus: GetCheckoutStatus;
@@ -1,8 +0,0 @@
1
- /**
2
- * Get Checkout Status action
3
- * Calls the getCheckoutStatus action on the parent window
4
- */
5
- import { commandFrameClient } from '../../client';
6
- export const getCheckoutStatus = async (params) => {
7
- return await commandFrameClient.call('getCheckoutStatus', params ?? {});
8
- };
@@ -1,3 +0,0 @@
1
- import { GetCheckoutStatus } from './types';
2
- /** Standalone mock: every order the preview knows about is already paid. */
3
- export declare const mockGetCheckoutStatus: GetCheckoutStatus;
@@ -1,11 +0,0 @@
1
- /** Standalone mock: every order the preview knows about is already paid. */
2
- export const mockGetCheckoutStatus = async (params) => {
3
- console.log('[Mock] getCheckoutStatus called', params);
4
- return {
5
- success: true,
6
- status: 'paid',
7
- paid: true,
8
- receiptId: params?.receiptId ?? 'ON-001-000001',
9
- timestamp: new Date().toISOString(),
10
- };
11
- };
@@ -1,20 +0,0 @@
1
- /** The shopper-facing vocabulary: never the platform's payment / fulfilment states. */
2
- export type CheckoutOrderStatus = 'awaiting_payment' | 'confirming' | 'payment_failed' | 'paid' | 'fulfilled' | 'partially_refunded' | 'refunded' | 'cancelled';
3
- export interface GetCheckoutStatusParams {
4
- /**
5
- * The receipt `startCheckout` returned, to name which order. Omitted: the checkout in flight,
6
- * else the last one this tab finished.
7
- */
8
- receiptId?: string;
9
- }
10
- export interface GetCheckoutStatusResponse {
11
- success: boolean;
12
- /** `null` when this tab placed no such order, or the server could not be asked. */
13
- status: CheckoutOrderStatus | null;
14
- /** True once the money is in: `paid`, `fulfilled`, or refunded since. */
15
- paid: boolean;
16
- receiptId: string | null;
17
- timestamp: string;
18
- }
19
- /** Never throws for an unknown order: answers `status: null`. */
20
- export type GetCheckoutStatus = (params?: GetCheckoutStatusParams) => Promise<GetCheckoutStatusResponse>;
@@ -1,12 +0,0 @@
1
- // Get Checkout Status Types
2
- //
3
- // Where an online order stands NOW, as the server holds it. A confirmation page uses it to move
4
- // from "we're confirming your payment" to "paid" once the payment provider's notification has
5
- // landed, which the browser alone can never know: it only ever sees that the provider ACCEPTED
6
- // a payment.
7
- //
8
- // The runtime asks about a checkout THIS TAB placed (it keeps the checkout's key), so a page can
9
- // only ever ask about its own order. No password: the server no longer issues one.
10
- //
11
- // Served ONLY by the storefront runtime (a published website). On a register it does not exist.
12
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * Get MOTO config action
3
- * Calls the getMotoConfig action on the parent window
4
- */
5
- import type { GetMotoConfig } from './types';
6
- export declare const getMotoConfig: GetMotoConfig;
@@ -1,8 +0,0 @@
1
- /**
2
- * Get MOTO config action
3
- * Calls the getMotoConfig action on the parent window
4
- */
5
- import { commandFrameClient } from '../../client';
6
- export const getMotoConfig = async () => {
7
- return await commandFrameClient.call('getMotoConfig', undefined);
8
- };
@@ -1,7 +0,0 @@
1
- import { GetMotoConfig } from './types';
2
- /**
3
- * The mock has no Adyen account to mount card fields against, so it answers honestly: not
4
- * available. A flow that hides its manual card tender on `available: false` behaves the same
5
- * in a preview as on a host without a key.
6
- */
7
- export declare const mockGetMotoConfig: GetMotoConfig;
@@ -1,9 +0,0 @@
1
- /**
2
- * The mock has no Adyen account to mount card fields against, so it answers honestly: not
3
- * available. A flow that hides its manual card tender on `available: false` behaves the same
4
- * in a preview as on a host without a key.
5
- */
6
- export const mockGetMotoConfig = async () => {
7
- console.log('[Mock] getMotoConfig called');
8
- return { success: true, timestamp: new Date().toISOString(), available: false, reason: 'no-client-key' };
9
- };
@@ -1,34 +0,0 @@
1
- /**
2
- * Get MOTO config — everything a flow needs to take a keyed (card-not-present) payment itself:
3
- * mount the processor's own card-entry fields, then send what they produce to `chargeMoto`.
4
- */
5
- /** Why manual card entry is not available here. */
6
- export type MotoUnavailableReason =
7
- /** The company does not take new sales on Adyen (keyed charges are Adyen-only today). */
8
- 'provider-unsupported'
9
- /** The host injected no Adyen client key (an older host, or an environment without one). */
10
- | 'no-client-key'
11
- /** The company's Adyen integration has no country yet. */
12
- | 'no-country'
13
- /** No active company. */
14
- | 'no-company';
15
- export type GetMotoConfigResponse = {
16
- success: boolean;
17
- timestamp: string;
18
- } & ({
19
- available: true;
20
- provider: 'adyen';
21
- /**
22
- * Adyen's PUBLISHABLE client key for `@adyen/adyen-web`'s `AdyenCheckout({ clientKey })`.
23
- * Injected by the host at runtime — never bake one into a flow build.
24
- */
25
- clientKey: string;
26
- /** `AdyenCheckout({ environment })`. */
27
- environment: 'test' | 'live';
28
- /** The company's country, ISO 3166-1 alpha-2 — `AdyenCheckout({ countryCode })`. */
29
- countryCode: string;
30
- } | {
31
- available: false;
32
- reason: MotoUnavailableReason;
33
- });
34
- export type GetMotoConfig = () => Promise<GetMotoConfigResponse>;
@@ -1,5 +0,0 @@
1
- /**
2
- * Get MOTO config — everything a flow needs to take a keyed (card-not-present) payment itself:
3
- * mount the processor's own card-entry fields, then send what they produce to `chargeMoto`.
4
- */
5
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * Get order statuses action
3
- * Calls the getOrderStatuses action on the parent window
4
- */
5
- import type { GetOrderStatuses } from './types';
6
- export declare const getOrderStatuses: GetOrderStatuses;
@@ -1,8 +0,0 @@
1
- /**
2
- * Get order statuses action
3
- * Calls the getOrderStatuses action on the parent window
4
- */
5
- import { commandFrameClient } from '../../client';
6
- export const getOrderStatuses = async () => {
7
- return await commandFrameClient.call('getOrderStatuses', undefined);
8
- };
@@ -1,2 +0,0 @@
1
- import type { GetOrderStatuses } from './types';
2
- export declare const mockGetOrderStatuses: GetOrderStatuses;
@@ -1,5 +0,0 @@
1
- import { MOCK_ORDER_STATUSES } from '../../demo/database';
2
- export const mockGetOrderStatuses = async () => {
3
- console.log('[Mock] getOrderStatuses called');
4
- return { success: true, statuses: MOCK_ORDER_STATUSES.map((s) => ({ ...s })), timestamp: new Date().toISOString() };
5
- };
@@ -1,8 +0,0 @@
1
- import type { CFOrderStatusDefinition } from '../../common-types/order-state';
2
- export interface GetOrderStatusesResponse {
3
- success: boolean;
4
- /** The running flow's order statuses, in the order they were defined. Empty when it defines none. */
5
- statuses: CFOrderStatusDefinition[];
6
- timestamp: string;
7
- }
8
- export type GetOrderStatuses = () => Promise<GetOrderStatusesResponse>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * GetShippingOptions action
3
- * Calls the getShippingOptions action on the parent window
4
- */
5
- import type { GetShippingOptions } from './types';
6
- export declare const getShippingOptions: GetShippingOptions;
@@ -1,8 +0,0 @@
1
- /**
2
- * GetShippingOptions action
3
- * Calls the getShippingOptions action on the parent window
4
- */
5
- import { commandFrameClient } from '../../client';
6
- export const getShippingOptions = async () => {
7
- return await commandFrameClient.call('getShippingOptions', undefined);
8
- };
@@ -1,3 +0,0 @@
1
- import type { GetShippingOptions } from './types';
2
- /** Standalone mock: the demo store's zones run through the real resolver, as the website would. */
3
- export declare const mockGetShippingOptions: GetShippingOptions;
@@ -1,15 +0,0 @@
1
- import { MOCK_SHIPPING_ZONES, mockShippingOptions } from '../../demo/shipping';
2
- /** Standalone mock: the demo store's zones run through the real resolver, as the website would. */
3
- export const mockGetShippingOptions = async () => {
4
- console.log('[Mock] getShippingOptions called');
5
- const { resolution, options } = mockShippingOptions();
6
- const message = resolution.message ??
7
- (options.length === 0 && resolution.reason === 'NO_COVERAGE' ? 'Sorry, we only ship within Canada.' : null);
8
- return {
9
- required: MOCK_SHIPPING_ZONES.length > 0,
10
- options,
11
- reason: resolution.reason,
12
- message,
13
- timestamp: new Date().toISOString(),
14
- };
15
- };
@@ -1,43 +0,0 @@
1
- import type { ShippingNoOptionReason, ShippingOptionType } from '@final-commerce/common';
2
- export interface ShippingPickupView {
3
- outletId: string;
4
- /** The store's name, e.g. "Duckworth Street". */
5
- name: string;
6
- /** One line per open day, e.g. "Mon–Fri 9:00 AM – 6:00 PM". Empty when the store set no hours. */
7
- hours: string[];
8
- }
9
- export interface ShippingOptionView {
10
- optionId: string;
11
- type: ShippingOptionType | `${ShippingOptionType}`;
12
- /** "Standard shipping", or "Pickup at Duckworth Street". */
13
- name: string;
14
- /** What this option costs on this cart, minor units, before its tax. */
15
- amount: number;
16
- /** "$10.00" or "Free". */
17
- priceText: string;
18
- /** "Add $20.00 more for free shipping", when a free-shipping line exists and isn't reached. */
19
- freeShippingHint: string | null;
20
- /** "Arrives Tue, Oct 20 – Fri, Oct 23", counted in business days from today. Null for pickup. */
21
- arrivalText: string | null;
22
- pickup: ShippingPickupView | null;
23
- /** The option on the cart now. The cheapest is chosen by default. */
24
- selected: boolean;
25
- }
26
- export interface GetShippingOptionsResponse {
27
- /**
28
- * False when this store doesn't ship at all (no shipping set up) or the cart has
29
- * nothing to ship: show no shipping step.
30
- */
31
- required: boolean;
32
- /** Ship options cheapest first, then pickups. */
33
- options: ShippingOptionView[];
34
- /** Why there is nothing to choose; null when `options` isn't empty. */
35
- reason: ShippingNoOptionReason | `${ShippingNoOptionReason}` | null;
36
- /**
37
- * What to tell the customer: the store's "we don't ship here" message, or the
38
- * default for the reason ("Sorry, we only ship within Canada."). Null when there are options.
39
- */
40
- message: string | null;
41
- timestamp: string;
42
- }
43
- export type GetShippingOptions = () => Promise<GetShippingOptionsResponse>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * Record external payment action
3
- * Calls the recordExternalPayment action on the parent window
4
- */
5
- import type { RecordExternalPayment } from './types';
6
- export declare const recordExternalPayment: RecordExternalPayment;
@@ -1,8 +0,0 @@
1
- /**
2
- * Record external payment action
3
- * Calls the recordExternalPayment action on the parent window
4
- */
5
- import { commandFrameClient } from '../../client';
6
- export const recordExternalPayment = async (params) => {
7
- return await commandFrameClient.call('recordExternalPayment', params);
8
- };
@@ -1,2 +0,0 @@
1
- import type { RecordExternalPayment } from './types';
2
- export declare const mockRecordExternalPayment: RecordExternalPayment;