@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.
- package/dist/CommonTypes.d.ts +25 -1
- package/dist/actions/add-product-fee/mock.d.ts +1 -1
- package/dist/actions/add-product-fee/mock.js +15 -9
- package/dist/actions/add-product-to-cart/mock.d.ts +23 -0
- package/dist/actions/add-product-to-cart/mock.js +300 -1
- package/dist/actions/add-product-to-cart/types.d.ts +27 -1
- package/dist/actions/get-composite-availability/action.d.ts +6 -0
- package/dist/actions/get-composite-availability/action.js +8 -0
- package/dist/actions/get-composite-availability/mock.d.ts +2 -0
- package/dist/actions/get-composite-availability/mock.js +45 -0
- package/dist/actions/get-composite-availability/types.d.ts +29 -0
- package/dist/actions/get-composite-availability/types.js +1 -0
- package/dist/actions/get-composite-price/action.d.ts +6 -0
- package/dist/actions/get-composite-price/action.js +8 -0
- package/dist/actions/get-composite-price/mock.d.ts +2 -0
- package/dist/actions/get-composite-price/mock.js +37 -0
- package/dist/actions/get-composite-price/types.d.ts +31 -0
- package/dist/actions/get-composite-price/types.js +1 -0
- package/dist/actions/get-current-cart/mock.d.ts +1 -1
- package/dist/actions/get-current-cart/mock.js +13 -3
- package/dist/actions/get-current-cart/types.d.ts +7 -1
- package/dist/actions/get-product-modifier-selections/mock.js +12 -0
- package/dist/actions/get-products/mock.js +7 -3
- package/dist/actions/get-products/types.d.ts +1 -1
- package/dist/actions/set-product-modifier-selections/mock.js +12 -0
- package/dist/demo/database.d.ts +39 -1
- package/dist/demo/database.js +218 -3
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/projects/render/mocks.js +4 -0
- package/dist/projects/render/types.d.ts +3 -1
- package/dist/pubsub/topics/products/catalog-visibility-changed/types.d.ts +17 -0
- package/dist/pubsub/topics/products/catalog-visibility-changed/types.js +1 -0
- package/dist/pubsub/topics/products/composite-changed/types.d.ts +17 -0
- package/dist/pubsub/topics/products/composite-changed/types.js +1 -0
- package/dist/pubsub/topics/products/index.d.ts +2 -2
- package/dist/pubsub/topics/products/index.js +33 -18
- package/dist/pubsub/topics/products/inventory-changed/types.d.ts +18 -0
- package/dist/pubsub/topics/products/inventory-changed/types.js +1 -0
- package/dist/pubsub/topics/products/types.d.ts +16 -10
- package/dist/pubsub/topics/products/types.js +7 -4
- 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:
|
|
7
|
-
name:
|
|
8
|
-
description:
|
|
6
|
+
id: 'products',
|
|
7
|
+
name: 'Products',
|
|
8
|
+
description: 'Topic for product-related events',
|
|
9
9
|
eventTypes: [
|
|
10
10
|
{
|
|
11
|
-
id:
|
|
12
|
-
name:
|
|
13
|
-
description:
|
|
11
|
+
id: 'product-created',
|
|
12
|
+
name: 'Product Created',
|
|
13
|
+
description: 'Published when a new product is synced/created',
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
|
-
id:
|
|
17
|
-
name:
|
|
18
|
-
description:
|
|
16
|
+
id: 'product-updated',
|
|
17
|
+
name: 'Product Updated',
|
|
18
|
+
description: 'Published when a product is synced/updated',
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
|
-
id:
|
|
22
|
-
name:
|
|
23
|
-
description: "Published when a
|
|
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:
|
|
27
|
-
name:
|
|
28
|
-
description:
|
|
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
|
|
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>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,13 +2,19 @@
|
|
|
2
2
|
* Products Topic Types
|
|
3
3
|
* Aggregated types for all product-related events
|
|
4
4
|
*/
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import type {
|
|
13
|
-
|
|
14
|
-
|
|
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
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
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.
|
|
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.
|
|
60
|
+
"@final-commerce/common": "2.5.0-staging.1"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@commitlint/cli": "^19.0.0",
|