@final-commerce/command-frame 0.8.0-online.4 → 0.8.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 (102) hide show
  1. package/dist/CommonTypes.d.ts +26 -1
  2. package/dist/actions/add-booking-to-cart/action.d.ts +6 -0
  3. package/dist/actions/add-booking-to-cart/action.js +8 -0
  4. package/dist/actions/add-booking-to-cart/mock.d.ts +2 -0
  5. package/dist/actions/add-booking-to-cart/mock.js +42 -0
  6. package/dist/actions/add-booking-to-cart/types.d.ts +23 -0
  7. package/dist/actions/cancel-booking/action.d.ts +6 -0
  8. package/dist/actions/cancel-booking/action.js +8 -0
  9. package/dist/actions/cancel-booking/mock.d.ts +2 -0
  10. package/dist/actions/cancel-booking/mock.js +10 -0
  11. package/dist/actions/cancel-booking/types.d.ts +10 -0
  12. package/dist/actions/get-booking-availability/action.d.ts +6 -0
  13. package/dist/actions/get-booking-availability/action.js +8 -0
  14. package/dist/actions/get-booking-availability/mock.d.ts +2 -0
  15. package/dist/actions/get-booking-availability/mock.js +6 -0
  16. package/dist/actions/get-booking-availability/types.d.ts +18 -0
  17. package/dist/actions/get-booking-resources/action.d.ts +6 -0
  18. package/dist/actions/get-booking-resources/action.js +8 -0
  19. package/dist/actions/get-booking-resources/mock.d.ts +2 -0
  20. package/dist/actions/get-booking-resources/mock.js +7 -0
  21. package/dist/actions/get-booking-resources/types.d.ts +12 -0
  22. package/dist/actions/get-booking-resources/types.js +1 -0
  23. package/dist/actions/get-bookings/action.d.ts +6 -0
  24. package/dist/actions/get-bookings/action.js +8 -0
  25. package/dist/actions/get-bookings/mock.d.ts +2 -0
  26. package/dist/actions/get-bookings/mock.js +20 -0
  27. package/dist/actions/get-bookings/types.d.ts +18 -0
  28. package/dist/actions/get-bookings/types.js +1 -0
  29. package/dist/actions/get-context/mock.js +4 -0
  30. package/dist/actions/get-product-modifier-selections/action.d.ts +1 -1
  31. package/dist/actions/get-product-modifier-selections/action.js +2 -2
  32. package/dist/actions/get-product-modifier-selections/mock.d.ts +1 -1
  33. package/dist/actions/get-product-modifier-selections/mock.js +5 -5
  34. package/dist/actions/get-product-modifier-selections/types.d.ts +1 -1
  35. package/dist/actions/get-products/mock.js +6 -0
  36. package/dist/actions/get-products/types.d.ts +25 -3
  37. package/dist/actions/get-refund-plan/types.d.ts +5 -2
  38. package/dist/actions/get-remaining-refundable-quantities/mock.js +1 -0
  39. package/dist/actions/get-remaining-refundable-quantities/types.d.ts +8 -0
  40. package/dist/actions/hold-booking/action.d.ts +6 -0
  41. package/dist/actions/hold-booking/action.js +8 -0
  42. package/dist/actions/hold-booking/mock.d.ts +2 -0
  43. package/dist/actions/hold-booking/mock.js +33 -0
  44. package/dist/actions/hold-booking/types.d.ts +24 -0
  45. package/dist/actions/hold-booking/types.js +1 -0
  46. package/dist/actions/process-partial-refund/types.d.ts +2 -2
  47. package/dist/actions/remove-booking-from-cart/action.d.ts +6 -0
  48. package/dist/actions/remove-booking-from-cart/action.js +8 -0
  49. package/dist/actions/remove-booking-from-cart/mock.d.ts +2 -0
  50. package/dist/actions/remove-booking-from-cart/mock.js +26 -0
  51. package/dist/actions/remove-booking-from-cart/types.d.ts +12 -0
  52. package/dist/actions/remove-booking-from-cart/types.js +1 -0
  53. package/dist/actions/set-product-modifier-selections/action.d.ts +1 -1
  54. package/dist/actions/set-product-modifier-selections/action.js +2 -2
  55. package/dist/actions/set-product-modifier-selections/mock.d.ts +1 -1
  56. package/dist/actions/set-product-modifier-selections/mock.js +7 -7
  57. package/dist/actions/set-product-modifier-selections/types.d.ts +2 -2
  58. package/dist/demo/database.d.ts +12 -1
  59. package/dist/demo/database.js +127 -0
  60. package/dist/index.d.ts +16 -6
  61. package/dist/index.js +15 -5
  62. package/dist/projects/render/mocks.js +14 -4
  63. package/dist/projects/render/types.d.ts +8 -13
  64. package/dist/pubsub/topics/bookings/booking-created/types.d.ts +6 -0
  65. package/dist/pubsub/topics/bookings/booking-created/types.js +1 -0
  66. package/dist/pubsub/topics/bookings/booking-setup-changed/types.d.ts +15 -0
  67. package/dist/pubsub/topics/bookings/booking-setup-changed/types.js +1 -0
  68. package/dist/pubsub/topics/bookings/booking-updated/types.d.ts +6 -0
  69. package/dist/pubsub/topics/bookings/booking-updated/types.js +1 -0
  70. package/dist/pubsub/topics/bookings/index.d.ts +3 -0
  71. package/dist/pubsub/topics/bookings/index.js +27 -0
  72. package/dist/pubsub/topics/bookings/types.d.ts +8 -0
  73. package/dist/pubsub/topics/bookings/types.js +3 -0
  74. package/dist/pubsub/topics/cart/product-modifiers-updated/types.d.ts +2 -2
  75. package/dist/pubsub/topics/cart/types.d.ts +33 -33
  76. package/dist/pubsub/topics/cart/types.js +16 -16
  77. package/dist/pubsub/topics/index.d.ts +17 -17
  78. package/dist/pubsub/topics/index.js +17 -17
  79. package/dist/pubsub/topics/types.d.ts +2 -8
  80. package/package.json +2 -2
  81. package/dist/actions/resume-checkout/action.d.ts +0 -6
  82. package/dist/actions/resume-checkout/action.js +0 -8
  83. package/dist/actions/resume-checkout/mock.d.ts +0 -16
  84. package/dist/actions/resume-checkout/mock.js +0 -51
  85. package/dist/actions/resume-checkout/types.d.ts +0 -59
  86. package/dist/actions/resume-checkout/types.js +0 -13
  87. package/dist/actions/start-checkout/action.d.ts +0 -6
  88. package/dist/actions/start-checkout/action.js +0 -8
  89. package/dist/actions/start-checkout/mock.d.ts +0 -16
  90. package/dist/actions/start-checkout/mock.js +0 -80
  91. package/dist/actions/start-checkout/types.d.ts +0 -81
  92. package/dist/actions/start-checkout/types.js +0 -10
  93. package/dist/pubsub/topics/checkout/checkout-started/types.d.ts +0 -26
  94. package/dist/pubsub/topics/checkout/index.d.ts +0 -7
  95. package/dist/pubsub/topics/checkout/index.js +0 -28
  96. package/dist/pubsub/topics/checkout/payment-completed/types.d.ts +0 -31
  97. package/dist/pubsub/topics/checkout/payment-failed/types.d.ts +0 -20
  98. package/dist/pubsub/topics/checkout/types.d.ts +0 -12
  99. package/dist/pubsub/topics/checkout/types.js +0 -8
  100. /package/dist/{pubsub/topics/checkout/checkout-started → actions/add-booking-to-cart}/types.js +0 -0
  101. /package/dist/{pubsub/topics/checkout/payment-completed → actions/cancel-booking}/types.js +0 -0
  102. /package/dist/{pubsub/topics/checkout/payment-failed → actions/get-booking-availability}/types.js +0 -0
@@ -1,81 +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 StartCheckoutContact {
6
- email: string;
7
- name?: string;
8
- phone?: string;
9
- }
10
- export interface StartCheckoutParams {
11
- contact: StartCheckoutContact;
12
- /**
13
- * CSS SELECTOR for the element the payment fields mount into, e.g.
14
- * `'#card-fields'`. The element must already be in the DOM when this is
15
- * called.
16
- *
17
- * A SELECTOR, NOT AN ELEMENT — and this is not a style preference. Command
18
- * params cross a `postMessage` boundary, which serializes them with the
19
- * structured clone algorithm; a DOM node is not cloneable, so passing
20
- * `ref.current` throws `DataCloneError: HTMLDivElement object could not be
21
- * cloned` before the command is ever sent. The string is resolved on the
22
- * runtime's side against the same document the page rendered.
23
- */
24
- container: string;
25
- /**
26
- * Where the provider returns the shopper after a redirect payment method
27
- * (bank apps, wallets). Defaults to the current URL.
28
- *
29
- * Must be HTTPS and on the SAME ORIGIN the storefront token was minted for;
30
- * the server rejects anything else, since this URL is handed to a payment
31
- * provider and an open redirect on a checkout is a phishing primitive.
32
- */
33
- returnUrl?: string;
34
- /**
35
- * Overrides the cart-derived idempotency key. Leave unset: the default is
36
- * derived from the cart, which is what makes a shopper's double-tap on "Pay"
37
- * return the SAME order instead of creating a second, abandoned one.
38
- */
39
- idempotencyKey?: string;
40
- /** Defaults to the outlet the storefront booted against. */
41
- outletId?: string;
42
- /** Forwarded verbatim to the provider's Drop-in (`showPayButton`, `locale`, field styling, …). */
43
- dropinConfiguration?: Record<string, unknown>;
44
- }
45
- /**
46
- * The created order. Deliberately says nothing about money having moved — see
47
- * `paymentStatus` and the `checkout` topic.
48
- */
49
- export interface StartCheckoutOrder {
50
- orderId: string;
51
- receiptId: string;
52
- /** The SERVER-computed total in integer minor units — the only total that matters. */
53
- serverTotal: number;
54
- currency: string;
55
- /**
56
- * `ready` — the payment fields are mounted and the shopper can pay.
57
- * `unavailable` — THE ORDER EXISTS but no payment could be started, so the
58
- * shopper has NOT been charged. Never report this as a failed order.
59
- */
60
- paymentStatus: 'ready' | 'unavailable';
61
- /**
62
- * One-time password for reading this order back, returned only on the first
63
- * create. It is the ONLY route to this order's status — the guest token
64
- * grants order creation and deliberately not order reads — so a caller that
65
- * drops it cannot check whether the payment settled.
66
- */
67
- orderPassword?: string;
68
- }
69
- export interface StartCheckoutResponse {
70
- success: boolean;
71
- timestamp: string;
72
- order: StartCheckoutOrder;
73
- }
74
- /**
75
- * Creates the server-priced order and mounts the provider's hosted card fields.
76
- *
77
- * RESOLVES WHEN THE SHOPPER *CAN* PAY, NOT WHEN THEY HAVE. The shopper has not
78
- * typed a card yet when this returns. The outcome arrives on the `checkout`
79
- * topic instead.
80
- */
81
- export type StartCheckout = (params: StartCheckoutParams) => Promise<StartCheckoutResponse>;
@@ -1,10 +0,0 @@
1
- // Start Checkout Types
2
- //
3
- // The ONLINE counterpart of the POS tenders: a shopper on a published website
4
- // pays for the current cart with their own card. Mirrors kaching's storefront
5
- // `startCheckout` input and result. All money is integer MINOR currency units.
6
- //
7
- // This command is served ONLY by the storefront runtime (a published website).
8
- // On a register it does not exist, exactly as the till tenders (`cashPayment`,
9
- // `terminalPayment`, `tapToPayPayment`, `chargeMoto`) do not exist online.
10
- export {};
@@ -1,26 +0,0 @@
1
- import type { TopicEvent } from "../../../types";
2
- /**
3
- * Payload for checkout-started event
4
- *
5
- * The order EXISTS and is unpaid. `serverTotal` is the server's own price for
6
- * the cart, in integer minor units — the browser never sends a price, so this
7
- * is the first and only authoritative total.
8
- */
9
- export interface CheckoutStartedPayload {
10
- orderId: string;
11
- receiptId: string;
12
- serverTotal: number;
13
- currency: string;
14
- /**
15
- * `ready` — the payment fields are mounted and the shopper can pay.
16
- * `unavailable` — the order exists but no payment could be started, so the
17
- * shopper has NOT been charged.
18
- */
19
- paymentStatus: "ready" | "unavailable";
20
- /** One-time password for reading this order back. Returned only on the first create. */
21
- orderPassword?: string;
22
- }
23
- /**
24
- * Typed event for checkout-started
25
- */
26
- export type CheckoutStartedEvent = TopicEvent<CheckoutStartedPayload>;
@@ -1,7 +0,0 @@
1
- /**
2
- * Checkout Topic Definition
3
- * Defines the checkout topic and its available event types
4
- */
5
- import type { TopicDefinition } from "../../types";
6
- export declare const checkoutTopic: TopicDefinition;
7
- export * from "./types";
@@ -1,28 +0,0 @@
1
- /**
2
- * Checkout Topic Definition
3
- * Defines the checkout topic and its available event types
4
- */
5
- export const checkoutTopic = {
6
- id: "checkout",
7
- name: "Checkout",
8
- description: "Topic for online (website) checkout events",
9
- eventTypes: [
10
- {
11
- id: "checkout-started",
12
- name: "Checkout Started",
13
- description: "Published when the order has been created and the payment fields are mounted"
14
- },
15
- {
16
- id: "payment-completed",
17
- name: "Payment Completed",
18
- description: "Published when the shopper's payment succeeds on their side (authorisation, not settlement)"
19
- },
20
- {
21
- id: "payment-failed",
22
- name: "Payment Failed",
23
- description: "Published when a payment attempt is refused or errors; the shopper can retry"
24
- }
25
- ]
26
- };
27
- // Re-export types
28
- export * from "./types";
@@ -1,31 +0,0 @@
1
- import type { TopicEvent } from "../../../types";
2
- /**
3
- * Payload for payment-completed event
4
- *
5
- * THIS IS NOT SETTLEMENT. It reports that the SHOPPER'S side finished —
6
- * `resultCode` is the provider's own outcome, typically `Authorised`. The money
7
- * is confirmed by the provider's capture webhook reaching the backend, out of
8
- * band and after this page is done, so this event cannot and does not claim it.
9
- */
10
- export interface PaymentCompletedPayload {
11
- orderId: string;
12
- receiptId: string;
13
- /** The provider's result code, e.g. `Authorised`. */
14
- resultCode: string;
15
- /**
16
- * OPAQUE PROOF OF THIS PAYMENT, handed to the browser by the provider and to
17
- * nobody else. Pass it to the order-status read and the server verifies it
18
- * with the provider before believing a word of it.
19
- *
20
- * It is the only evidence of an outcome that exists outside the provider's
21
- * webhook, so it is what recovers an order whose confirmation never arrived.
22
- * Treat it as a credential: do not log it, do not put it in a URL you share.
23
- *
24
- * Absent when the provider reported no payment (see `resultCode`).
25
- */
26
- sessionResult?: string;
27
- }
28
- /**
29
- * Typed event for payment-completed
30
- */
31
- export type PaymentCompletedEvent = TopicEvent<PaymentCompletedPayload>;
@@ -1,20 +0,0 @@
1
- import type { TopicEvent } from "../../../types";
2
- /**
3
- * Payload for payment-failed event
4
- *
5
- * ONE DECLINED ATTEMPT, NOT A DEAD CHECKOUT. The order and the mounted payment
6
- * fields both survive, so the shopper can try another card without the page
7
- * starting a new checkout.
8
- */
9
- export interface PaymentFailedPayload {
10
- orderId: string;
11
- receiptId: string;
12
- /** The provider's result code, e.g. `Refused`, or an error name. */
13
- resultCode: string;
14
- /** Present when the failure carried a message worth showing. */
15
- message?: string;
16
- }
17
- /**
18
- * Typed event for payment-failed
19
- */
20
- export type PaymentFailedEvent = TopicEvent<PaymentFailedPayload>;
@@ -1,12 +0,0 @@
1
- /**
2
- * Checkout Topic Types
3
- * Aggregated types for all online-checkout events
4
- */
5
- export * from "./checkout-started/types";
6
- export * from "./payment-completed/types";
7
- export * from "./payment-failed/types";
8
- import type { CheckoutStartedPayload } from "./checkout-started/types";
9
- import type { PaymentCompletedPayload } from "./payment-completed/types";
10
- import type { PaymentFailedPayload } from "./payment-failed/types";
11
- export type CheckoutEventPayload = CheckoutStartedPayload | PaymentCompletedPayload | PaymentFailedPayload;
12
- export type CheckoutEventType = "checkout-started" | "payment-completed" | "payment-failed";
@@ -1,8 +0,0 @@
1
- /**
2
- * Checkout Topic Types
3
- * Aggregated types for all online-checkout events
4
- */
5
- // Re-export all event types
6
- export * from "./checkout-started/types";
7
- export * from "./payment-completed/types";
8
- export * from "./payment-failed/types";