@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
@@ -1,69 +0,0 @@
1
- import { resolveShipping } from '@final-commerce/common';
2
- import { MOCK_CART, MOCK_OUTLET_MAIN } from './database';
3
- /*
4
- * The demo store's Settings › Shipping, so a flow previewed against the mocks meets the real rules
5
- * (common's `resolveShipping`) rather than a canned list: Canada $10 (free over $100) or Express,
6
- * Quebec at $15, pickup at the demo store, and nowhere else.
7
- */
8
- export const MOCK_SHIPPING_ZONES = [
9
- {
10
- id: 'zone_canada',
11
- kind: 'country',
12
- places: [{ country: 'CA' }],
13
- ships: true,
14
- options: [
15
- {
16
- id: 'opt_standard',
17
- type: 'ship',
18
- name: 'Standard shipping',
19
- price: 1000,
20
- freeOver: 10000,
21
- minDays: 3,
22
- maxDays: 6,
23
- channels: ['web', 'pos'],
24
- },
25
- { id: 'opt_express', type: 'ship', name: 'Express', price: 2000, minDays: 1, maxDays: 2, channels: ['web'] },
26
- { id: 'opt_pickup', type: 'pickup', price: 0, channels: ['web'], outletId: MOCK_OUTLET_MAIN.id },
27
- ],
28
- },
29
- {
30
- id: 'zone_quebec',
31
- kind: 'province',
32
- places: [{ country: 'CA', province: 'QC' }],
33
- ships: true,
34
- options: [
35
- {
36
- id: 'opt_quebec',
37
- type: 'ship',
38
- name: 'Standard shipping',
39
- price: 1500,
40
- minDays: 4,
41
- maxDays: 7,
42
- channels: ['web', 'pos'],
43
- },
44
- ],
45
- },
46
- ];
47
- const STORE_NAME = MOCK_OUTLET_MAIN.name ?? 'the store';
48
- const money = (amount) => (amount === 0 ? 'Free' : `$${(amount / 100).toFixed(2)}`);
49
- /** The demo cart's options, shaped like the runtime's answer. The mock runs as the website. */
50
- export function mockShippingOptions() {
51
- const resolution = resolveShipping({
52
- zones: MOCK_SHIPPING_ZONES,
53
- address: MOCK_CART.shippingAddress,
54
- itemsTotal: MOCK_CART.subtotal,
55
- channel: 'web',
56
- });
57
- const options = resolution.options.map((option) => ({
58
- optionId: option.optionId,
59
- type: option.type,
60
- name: option.type === 'pickup' ? `Pickup at ${STORE_NAME}` : (option.name ?? ''),
61
- amount: option.amount,
62
- priceText: money(option.amount),
63
- freeShippingHint: option.amountToFree ? `Add ${money(option.amountToFree)} more for free shipping` : null,
64
- arrivalText: option.minDays != null ? `Arrives in ${option.minDays}–${option.maxDays} business days` : null,
65
- pickup: option.type === 'pickup' ? { outletId: MOCK_OUTLET_MAIN.id, name: STORE_NAME, hours: [] } : null,
66
- selected: MOCK_CART.shipping?.optionId === option.optionId,
67
- }));
68
- return { resolution, options };
69
- }
@@ -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 +0,0 @@
1
- export {};
@@ -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 +0,0 @@
1
- export {};
@@ -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";