@final-commerce/command-frame 0.8.0-staging.2 → 0.9.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 (42) hide show
  1. package/dist/CommonTypes.d.ts +25 -1
  2. package/dist/actions/add-product-fee/mock.d.ts +1 -1
  3. package/dist/actions/add-product-fee/mock.js +15 -9
  4. package/dist/actions/add-product-to-cart/mock.d.ts +23 -0
  5. package/dist/actions/add-product-to-cart/mock.js +300 -1
  6. package/dist/actions/add-product-to-cart/types.d.ts +27 -1
  7. package/dist/actions/get-composite-availability/action.d.ts +6 -0
  8. package/dist/actions/get-composite-availability/action.js +8 -0
  9. package/dist/actions/get-composite-availability/mock.d.ts +2 -0
  10. package/dist/actions/get-composite-availability/mock.js +45 -0
  11. package/dist/actions/get-composite-availability/types.d.ts +29 -0
  12. package/dist/actions/get-composite-availability/types.js +1 -0
  13. package/dist/actions/get-composite-price/action.d.ts +6 -0
  14. package/dist/actions/get-composite-price/action.js +8 -0
  15. package/dist/actions/get-composite-price/mock.d.ts +2 -0
  16. package/dist/actions/get-composite-price/mock.js +37 -0
  17. package/dist/actions/get-composite-price/types.d.ts +31 -0
  18. package/dist/actions/get-composite-price/types.js +1 -0
  19. package/dist/actions/get-current-cart/mock.d.ts +1 -1
  20. package/dist/actions/get-current-cart/mock.js +13 -3
  21. package/dist/actions/get-current-cart/types.d.ts +7 -1
  22. package/dist/actions/get-product-modifier-selections/mock.js +12 -0
  23. package/dist/actions/get-products/mock.js +7 -3
  24. package/dist/actions/get-products/types.d.ts +1 -1
  25. package/dist/actions/set-product-modifier-selections/mock.js +12 -0
  26. package/dist/demo/database.d.ts +39 -1
  27. package/dist/demo/database.js +218 -3
  28. package/dist/index.d.ts +4 -0
  29. package/dist/index.js +4 -0
  30. package/dist/projects/render/mocks.js +4 -0
  31. package/dist/projects/render/types.d.ts +3 -1
  32. package/dist/pubsub/topics/products/catalog-visibility-changed/types.d.ts +17 -0
  33. package/dist/pubsub/topics/products/catalog-visibility-changed/types.js +1 -0
  34. package/dist/pubsub/topics/products/composite-changed/types.d.ts +17 -0
  35. package/dist/pubsub/topics/products/composite-changed/types.js +1 -0
  36. package/dist/pubsub/topics/products/index.d.ts +2 -2
  37. package/dist/pubsub/topics/products/index.js +33 -18
  38. package/dist/pubsub/topics/products/inventory-changed/types.d.ts +18 -0
  39. package/dist/pubsub/topics/products/inventory-changed/types.js +1 -0
  40. package/dist/pubsub/topics/products/types.d.ts +16 -10
  41. package/dist/pubsub/topics/products/types.js +7 -4
  42. package/package.json +2 -2
@@ -3,31 +3,46 @@
3
3
  * Defines the products topic and its available event types
4
4
  */
5
5
  export const productsTopic = {
6
- id: "products",
7
- name: "Products",
8
- description: "Topic for product-related events",
6
+ id: 'products',
7
+ name: 'Products',
8
+ description: 'Topic for product-related events',
9
9
  eventTypes: [
10
10
  {
11
- id: "product-created",
12
- name: "Product Created",
13
- description: "Published when a new product is synced/created"
11
+ id: 'product-created',
12
+ name: 'Product Created',
13
+ description: 'Published when a new product is synced/created',
14
14
  },
15
15
  {
16
- id: "product-updated",
17
- name: "Product Updated",
18
- description: "Published when a product is synced/updated"
16
+ id: 'product-updated',
17
+ name: 'Product Updated',
18
+ description: 'Published when a product is synced/updated',
19
19
  },
20
20
  {
21
- id: "set-active-product",
22
- name: "Set Active Product",
23
- description: "Published when a product is set as the active product"
21
+ id: 'composite-changed',
22
+ name: 'Composite Changed',
23
+ description: "Published when a composite's part or item is synced; re-ask getProducts",
24
24
  },
25
25
  {
26
- id: "get-active-product",
27
- name: "Get Active Product",
28
- description: "Published when a product is retrieved as the active product"
29
- }
30
- ]
26
+ id: 'catalog-visibility-changed',
27
+ name: 'Catalog Visibility Changed',
28
+ description: 'Published when a product is hidden or shown at an outlet; re-ask getProducts',
29
+ },
30
+ {
31
+ id: 'inventory-changed',
32
+ name: 'Inventory Changed',
33
+ description: "Published when a variant's stock at an outlet syncs; re-ask getProducts",
34
+ },
35
+ {
36
+ id: 'set-active-product',
37
+ name: 'Set Active Product',
38
+ description: 'Published when a product is set as the active product',
39
+ },
40
+ {
41
+ id: 'get-active-product',
42
+ name: 'Get Active Product',
43
+ description: 'Published when a product is retrieved as the active product',
44
+ },
45
+ ],
31
46
  };
32
47
  // Re-export types
33
- export * from "./types";
48
+ export * from './types';
@@ -0,0 +1,18 @@
1
+ import type { TopicEvent } from '../../../types';
2
+ /**
3
+ * Payload for inventory-changed (B35): a variant's stock at an outlet moved. A composite may turn Sold out or
4
+ * Unavailable by its components' shelves — debounce, then re-ask `getProducts`.
5
+ */
6
+ export interface InventoryChangedPayload {
7
+ inventory: {
8
+ _id: string;
9
+ variantId: string;
10
+ outletId: string;
11
+ quantity?: number | null;
12
+ manageStock?: boolean;
13
+ };
14
+ }
15
+ /**
16
+ * Typed event for inventory-changed
17
+ */
18
+ export type InventoryChangedEvent = TopicEvent<InventoryChangedPayload>;
@@ -2,13 +2,19 @@
2
2
  * Products Topic Types
3
3
  * Aggregated types for all product-related events
4
4
  */
5
- export * from "./product-created/types";
6
- export * from "./product-updated/types";
7
- export * from "./product-set-active/types";
8
- export * from "./product-get-active/types";
9
- import type { ProductCreatedPayload } from "./product-created/types";
10
- import type { ProductUpdatedPayload } from "./product-updated/types";
11
- import type { ProductSetActivePayload } from "./product-set-active/types";
12
- import type { ProductGetActivePayload } from "./product-get-active/types";
13
- export type ProductsEventPayload = ProductCreatedPayload | ProductUpdatedPayload | ProductSetActivePayload | ProductGetActivePayload;
14
- export type ProductsEventType = "product-created" | "product-updated" | "set-active-product" | "get-active-product";
5
+ export * from './product-created/types';
6
+ export * from './product-updated/types';
7
+ export * from './composite-changed/types';
8
+ export * from './catalog-visibility-changed/types';
9
+ export * from './inventory-changed/types';
10
+ export * from './product-set-active/types';
11
+ export * from './product-get-active/types';
12
+ import type { ProductCreatedPayload } from './product-created/types';
13
+ import type { ProductUpdatedPayload } from './product-updated/types';
14
+ import type { CompositeChangedPayload } from './composite-changed/types';
15
+ import type { CatalogVisibilityChangedPayload } from './catalog-visibility-changed/types';
16
+ import type { InventoryChangedPayload } from './inventory-changed/types';
17
+ import type { ProductSetActivePayload } from './product-set-active/types';
18
+ import type { ProductGetActivePayload } from './product-get-active/types';
19
+ export type ProductsEventPayload = ProductCreatedPayload | ProductUpdatedPayload | CompositeChangedPayload | CatalogVisibilityChangedPayload | InventoryChangedPayload | ProductSetActivePayload | ProductGetActivePayload;
20
+ export type ProductsEventType = 'product-created' | 'product-updated' | 'composite-changed' | 'catalog-visibility-changed' | 'inventory-changed' | 'set-active-product' | 'get-active-product';
@@ -3,7 +3,10 @@
3
3
  * Aggregated types for all product-related events
4
4
  */
5
5
  // Re-export all event types
6
- export * from "./product-created/types";
7
- export * from "./product-updated/types";
8
- export * from "./product-set-active/types";
9
- export * from "./product-get-active/types";
6
+ export * from './product-created/types';
7
+ export * from './product-updated/types';
8
+ export * from './composite-changed/types';
9
+ export * from './catalog-visibility-changed/types';
10
+ export * from './inventory-changed/types';
11
+ export * from './product-set-active/types';
12
+ export * from './product-get-active/types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@final-commerce/command-frame",
3
- "version": "0.8.0-staging.2",
3
+ "version": "0.9.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.4.0-staging.2"
60
+ "@final-commerce/common": "2.5.0-staging.1"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@commitlint/cli": "^19.0.0",