@contractspec/example.marketplace 0.0.0-canary-20260113170453
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/LICENSE +21 -0
- package/README.md +141 -0
- package/dist/docs/index.d.ts +1 -0
- package/dist/docs/index.js +1 -0
- package/dist/docs/marketplace.docblock.d.ts +1 -0
- package/dist/docs/marketplace.docblock.js +115 -0
- package/dist/docs/marketplace.docblock.js.map +1 -0
- package/dist/entities/index.d.ts +309 -0
- package/dist/entities/index.d.ts.map +1 -0
- package/dist/entities/index.js +46 -0
- package/dist/entities/index.js.map +1 -0
- package/dist/entities/order.d.ts +105 -0
- package/dist/entities/order.d.ts.map +1 -0
- package/dist/entities/order.js +173 -0
- package/dist/entities/order.js.map +1 -0
- package/dist/entities/payout.d.ts +92 -0
- package/dist/entities/payout.d.ts.map +1 -0
- package/dist/entities/payout.js +162 -0
- package/dist/entities/payout.js.map +1 -0
- package/dist/entities/product.d.ts +93 -0
- package/dist/entities/product.d.ts.map +1 -0
- package/dist/entities/product.js +161 -0
- package/dist/entities/product.js.map +1 -0
- package/dist/entities/review.d.ts +83 -0
- package/dist/entities/review.d.ts.map +1 -0
- package/dist/entities/review.js +152 -0
- package/dist/entities/review.js.map +1 -0
- package/dist/entities/store.d.ts +60 -0
- package/dist/entities/store.d.ts.map +1 -0
- package/dist/entities/store.js +110 -0
- package/dist/entities/store.js.map +1 -0
- package/dist/example.d.ts +7 -0
- package/dist/example.d.ts.map +1 -0
- package/dist/example.js +58 -0
- package/dist/example.js.map +1 -0
- package/dist/handlers/index.d.ts +2 -0
- package/dist/handlers/index.js +3 -0
- package/dist/handlers/marketplace.handlers.d.ts +155 -0
- package/dist/handlers/marketplace.handlers.d.ts.map +1 -0
- package/dist/handlers/marketplace.handlers.js +329 -0
- package/dist/handlers/marketplace.handlers.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +32 -0
- package/dist/marketplace.capability.d.ts +9 -0
- package/dist/marketplace.capability.d.ts.map +1 -0
- package/dist/marketplace.capability.js +34 -0
- package/dist/marketplace.capability.js.map +1 -0
- package/dist/marketplace.feature.d.ts +12 -0
- package/dist/marketplace.feature.d.ts.map +1 -0
- package/dist/marketplace.feature.js +315 -0
- package/dist/marketplace.feature.js.map +1 -0
- package/dist/order/index.d.ts +5 -0
- package/dist/order/index.js +6 -0
- package/dist/order/order.enum.d.ts +10 -0
- package/dist/order/order.enum.d.ts.map +1 -0
- package/dist/order/order.enum.js +22 -0
- package/dist/order/order.enum.js.map +1 -0
- package/dist/order/order.event.d.ts +145 -0
- package/dist/order/order.event.d.ts.map +1 -0
- package/dist/order/order.event.js +216 -0
- package/dist/order/order.event.js.map +1 -0
- package/dist/order/order.operations.d.ts +368 -0
- package/dist/order/order.operations.d.ts.map +1 -0
- package/dist/order/order.operations.js +119 -0
- package/dist/order/order.operations.js.map +1 -0
- package/dist/order/order.presentation.d.ts +9 -0
- package/dist/order/order.presentation.d.ts.map +1 -0
- package/dist/order/order.presentation.js +86 -0
- package/dist/order/order.presentation.js.map +1 -0
- package/dist/order/order.schema.d.ts +165 -0
- package/dist/order/order.schema.d.ts.map +1 -0
- package/dist/order/order.schema.js +155 -0
- package/dist/order/order.schema.js.map +1 -0
- package/dist/payout/index.d.ts +5 -0
- package/dist/payout/index.js +6 -0
- package/dist/payout/payout.enum.d.ts +10 -0
- package/dist/payout/payout.enum.d.ts.map +1 -0
- package/dist/payout/payout.enum.js +17 -0
- package/dist/payout/payout.enum.js.map +1 -0
- package/dist/payout/payout.event.d.ts +63 -0
- package/dist/payout/payout.event.d.ts.map +1 -0
- package/dist/payout/payout.event.js +92 -0
- package/dist/payout/payout.event.js.map +1 -0
- package/dist/payout/payout.operations.d.ts +97 -0
- package/dist/payout/payout.operations.d.ts.map +1 -0
- package/dist/payout/payout.operations.js +53 -0
- package/dist/payout/payout.operations.js.map +1 -0
- package/dist/payout/payout.presentation.d.ts +8 -0
- package/dist/payout/payout.presentation.d.ts.map +1 -0
- package/dist/payout/payout.presentation.js +60 -0
- package/dist/payout/payout.presentation.js.map +1 -0
- package/dist/payout/payout.schema.d.ts +157 -0
- package/dist/payout/payout.schema.d.ts.map +1 -0
- package/dist/payout/payout.schema.js +116 -0
- package/dist/payout/payout.schema.js.map +1 -0
- package/dist/product/index.d.ts +5 -0
- package/dist/product/index.js +6 -0
- package/dist/product/product.enum.d.ts +10 -0
- package/dist/product/product.enum.d.ts.map +1 -0
- package/dist/product/product.enum.js +18 -0
- package/dist/product/product.enum.js.map +1 -0
- package/dist/product/product.event.d.ts +73 -0
- package/dist/product/product.event.d.ts.map +1 -0
- package/dist/product/product.event.js +120 -0
- package/dist/product/product.event.js.map +1 -0
- package/dist/product/product.operations.d.ts +273 -0
- package/dist/product/product.operations.d.ts.map +1 -0
- package/dist/product/product.operations.js +108 -0
- package/dist/product/product.operations.js.map +1 -0
- package/dist/product/product.presentation.d.ts +9 -0
- package/dist/product/product.presentation.d.ts.map +1 -0
- package/dist/product/product.presentation.js +86 -0
- package/dist/product/product.presentation.js.map +1 -0
- package/dist/product/product.schema.d.ts +218 -0
- package/dist/product/product.schema.d.ts.map +1 -0
- package/dist/product/product.schema.js +176 -0
- package/dist/product/product.schema.js.map +1 -0
- package/dist/review/index.d.ts +5 -0
- package/dist/review/index.js +6 -0
- package/dist/review/review.enum.d.ts +10 -0
- package/dist/review/review.enum.d.ts.map +1 -0
- package/dist/review/review.enum.js +16 -0
- package/dist/review/review.enum.js.map +1 -0
- package/dist/review/review.event.d.ts +55 -0
- package/dist/review/review.event.d.ts.map +1 -0
- package/dist/review/review.event.js +84 -0
- package/dist/review/review.event.js.map +1 -0
- package/dist/review/review.operations.d.ts +237 -0
- package/dist/review/review.operations.d.ts.map +1 -0
- package/dist/review/review.operations.js +106 -0
- package/dist/review/review.operations.js.map +1 -0
- package/dist/review/review.presentation.d.ts +8 -0
- package/dist/review/review.presentation.d.ts.map +1 -0
- package/dist/review/review.presentation.js +60 -0
- package/dist/review/review.presentation.js.map +1 -0
- package/dist/review/review.schema.d.ts +190 -0
- package/dist/review/review.schema.d.ts.map +1 -0
- package/dist/review/review.schema.js +156 -0
- package/dist/review/review.schema.js.map +1 -0
- package/dist/seeders/index.d.ts +10 -0
- package/dist/seeders/index.d.ts.map +1 -0
- package/dist/seeders/index.js +18 -0
- package/dist/seeders/index.js.map +1 -0
- package/dist/store/index.d.ts +5 -0
- package/dist/store/index.js +6 -0
- package/dist/store/store.enum.d.ts +10 -0
- package/dist/store/store.enum.d.ts.map +1 -0
- package/dist/store/store.enum.js +16 -0
- package/dist/store/store.enum.js.map +1 -0
- package/dist/store/store.event.d.ts +51 -0
- package/dist/store/store.event.d.ts.map +1 -0
- package/dist/store/store.event.js +80 -0
- package/dist/store/store.event.js.map +1 -0
- package/dist/store/store.operations.d.ts +131 -0
- package/dist/store/store.operations.d.ts.map +1 -0
- package/dist/store/store.operations.js +61 -0
- package/dist/store/store.operations.js.map +1 -0
- package/dist/store/store.presentation.d.ts +8 -0
- package/dist/store/store.presentation.d.ts.map +1 -0
- package/dist/store/store.presentation.js +60 -0
- package/dist/store/store.presentation.js.map +1 -0
- package/dist/store/store.schema.d.ts +84 -0
- package/dist/store/store.schema.d.ts.map +1 -0
- package/dist/store/store.schema.js +93 -0
- package/dist/store/store.schema.js.map +1 -0
- package/dist/tests/operations.test-spec.d.ts +11 -0
- package/dist/tests/operations.test-spec.d.ts.map +1 -0
- package/dist/tests/operations.test-spec.js +152 -0
- package/dist/tests/operations.test-spec.js.map +1 -0
- package/dist/ui/MarketplaceDashboard.d.ts +7 -0
- package/dist/ui/MarketplaceDashboard.d.ts.map +1 -0
- package/dist/ui/MarketplaceDashboard.js +319 -0
- package/dist/ui/MarketplaceDashboard.js.map +1 -0
- package/dist/ui/hooks/index.d.ts +2 -0
- package/dist/ui/hooks/index.js +5 -0
- package/dist/ui/hooks/useMarketplaceData.d.ts +23 -0
- package/dist/ui/hooks/useMarketplaceData.d.ts.map +1 -0
- package/dist/ui/hooks/useMarketplaceData.js +64 -0
- package/dist/ui/hooks/useMarketplaceData.js.map +1 -0
- package/dist/ui/index.d.ts +6 -0
- package/dist/ui/index.js +6 -0
- package/dist/ui/renderers/index.d.ts +2 -0
- package/dist/ui/renderers/index.js +3 -0
- package/dist/ui/renderers/marketplace.markdown.d.ts +28 -0
- package/dist/ui/renderers/marketplace.markdown.d.ts.map +1 -0
- package/dist/ui/renderers/marketplace.markdown.js +244 -0
- package/dist/ui/renderers/marketplace.markdown.js.map +1 -0
- package/package.json +149 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { CreateOrderInputModel, OrderModel, UpdateOrderStatusInputModel } from "./order.schema.js";
|
|
2
|
+
import { defineCommand } from "@contractspec/lib.contracts/operations";
|
|
3
|
+
|
|
4
|
+
//#region src/order/order.operations.ts
|
|
5
|
+
const OWNERS = ["@example.marketplace"];
|
|
6
|
+
/**
|
|
7
|
+
* Create a new order.
|
|
8
|
+
*/
|
|
9
|
+
const CreateOrderContract = defineCommand({
|
|
10
|
+
meta: {
|
|
11
|
+
key: "marketplace.order.create",
|
|
12
|
+
version: "1.0.0",
|
|
13
|
+
stability: "stable",
|
|
14
|
+
owners: [...OWNERS],
|
|
15
|
+
tags: [
|
|
16
|
+
"marketplace",
|
|
17
|
+
"order",
|
|
18
|
+
"create"
|
|
19
|
+
],
|
|
20
|
+
description: "Create a new order.",
|
|
21
|
+
goal: "Allow buyers to purchase products.",
|
|
22
|
+
context: "Checkout flow."
|
|
23
|
+
},
|
|
24
|
+
io: {
|
|
25
|
+
input: CreateOrderInputModel,
|
|
26
|
+
output: OrderModel
|
|
27
|
+
},
|
|
28
|
+
policy: { auth: "user" },
|
|
29
|
+
sideEffects: {
|
|
30
|
+
emits: [{
|
|
31
|
+
key: "marketplace.order.created",
|
|
32
|
+
version: "1.0.0",
|
|
33
|
+
when: "Order is created",
|
|
34
|
+
payload: OrderModel
|
|
35
|
+
}],
|
|
36
|
+
audit: ["marketplace.order.created"]
|
|
37
|
+
},
|
|
38
|
+
acceptance: {
|
|
39
|
+
scenarios: [{
|
|
40
|
+
key: "create-order-happy-path",
|
|
41
|
+
given: ["User is authenticated"],
|
|
42
|
+
when: ["User creates order with valid items"],
|
|
43
|
+
then: ["Order is created", "OrderCreated event is emitted"]
|
|
44
|
+
}],
|
|
45
|
+
examples: [{
|
|
46
|
+
key: "create-basic-order",
|
|
47
|
+
input: {
|
|
48
|
+
storeId: "store-123",
|
|
49
|
+
items: [{
|
|
50
|
+
productId: "prod-456",
|
|
51
|
+
quantity: 1,
|
|
52
|
+
unitPrice: 100
|
|
53
|
+
}]
|
|
54
|
+
},
|
|
55
|
+
output: {
|
|
56
|
+
id: "order-789",
|
|
57
|
+
status: "pending",
|
|
58
|
+
total: 100
|
|
59
|
+
}
|
|
60
|
+
}]
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
/**
|
|
64
|
+
* Update order status.
|
|
65
|
+
*/
|
|
66
|
+
const UpdateOrderStatusContract = defineCommand({
|
|
67
|
+
meta: {
|
|
68
|
+
key: "marketplace.order.updateStatus",
|
|
69
|
+
version: "1.0.0",
|
|
70
|
+
stability: "stable",
|
|
71
|
+
owners: [...OWNERS],
|
|
72
|
+
tags: [
|
|
73
|
+
"marketplace",
|
|
74
|
+
"order",
|
|
75
|
+
"status"
|
|
76
|
+
],
|
|
77
|
+
description: "Update order status.",
|
|
78
|
+
goal: "Track order fulfillment.",
|
|
79
|
+
context: "Order management."
|
|
80
|
+
},
|
|
81
|
+
io: {
|
|
82
|
+
input: UpdateOrderStatusInputModel,
|
|
83
|
+
output: OrderModel
|
|
84
|
+
},
|
|
85
|
+
policy: { auth: "user" },
|
|
86
|
+
sideEffects: {
|
|
87
|
+
emits: [{
|
|
88
|
+
key: "marketplace.order.statusUpdated",
|
|
89
|
+
version: "1.0.0",
|
|
90
|
+
when: "Status changes",
|
|
91
|
+
payload: OrderModel
|
|
92
|
+
}],
|
|
93
|
+
audit: ["marketplace.order.statusUpdated"]
|
|
94
|
+
},
|
|
95
|
+
acceptance: {
|
|
96
|
+
scenarios: [{
|
|
97
|
+
key: "update-status-happy-path",
|
|
98
|
+
given: ["Order exists"],
|
|
99
|
+
when: ["Seller updates order status"],
|
|
100
|
+
then: ["Status is updated", "OrderStatusUpdated event is emitted"]
|
|
101
|
+
}],
|
|
102
|
+
examples: [{
|
|
103
|
+
key: "mark-shipped",
|
|
104
|
+
input: {
|
|
105
|
+
orderId: "order-789",
|
|
106
|
+
status: "shipped",
|
|
107
|
+
trackingNumber: "TRACK123"
|
|
108
|
+
},
|
|
109
|
+
output: {
|
|
110
|
+
id: "order-789",
|
|
111
|
+
status: "shipped"
|
|
112
|
+
}
|
|
113
|
+
}]
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
//#endregion
|
|
118
|
+
export { CreateOrderContract, UpdateOrderStatusContract };
|
|
119
|
+
//# sourceMappingURL=order.operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order.operations.js","names":[],"sources":["../../src/order/order.operations.ts"],"sourcesContent":["import { defineCommand } from '@contractspec/lib.contracts/operations';\nimport {\n OrderModel,\n CreateOrderInputModel,\n UpdateOrderStatusInputModel,\n} from './order.schema';\n\nconst OWNERS = ['@example.marketplace'] as const;\n\n/**\n * Create a new order.\n */\nexport const CreateOrderContract = defineCommand({\n meta: {\n key: 'marketplace.order.create',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['marketplace', 'order', 'create'],\n description: 'Create a new order.',\n goal: 'Allow buyers to purchase products.',\n context: 'Checkout flow.',\n },\n io: { input: CreateOrderInputModel, output: OrderModel },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'marketplace.order.created',\n version: '1.0.0',\n when: 'Order is created',\n payload: OrderModel,\n },\n ],\n audit: ['marketplace.order.created'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'create-order-happy-path',\n given: ['User is authenticated'],\n when: ['User creates order with valid items'],\n then: ['Order is created', 'OrderCreated event is emitted'],\n },\n ],\n examples: [\n {\n key: 'create-basic-order',\n input: {\n storeId: 'store-123',\n items: [{ productId: 'prod-456', quantity: 1, unitPrice: 100 }],\n },\n output: { id: 'order-789', status: 'pending', total: 100 },\n },\n ],\n },\n});\n\n/**\n * Update order status.\n */\nexport const UpdateOrderStatusContract = defineCommand({\n meta: {\n key: 'marketplace.order.updateStatus',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['marketplace', 'order', 'status'],\n description: 'Update order status.',\n goal: 'Track order fulfillment.',\n context: 'Order management.',\n },\n io: { input: UpdateOrderStatusInputModel, output: OrderModel },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'marketplace.order.statusUpdated',\n version: '1.0.0',\n when: 'Status changes',\n payload: OrderModel,\n },\n ],\n audit: ['marketplace.order.statusUpdated'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'update-status-happy-path',\n given: ['Order exists'],\n when: ['Seller updates order status'],\n then: ['Status is updated', 'OrderStatusUpdated event is emitted'],\n },\n ],\n examples: [\n {\n key: 'mark-shipped',\n input: {\n orderId: 'order-789',\n status: 'shipped',\n trackingNumber: 'TRACK123',\n },\n output: { id: 'order-789', status: 'shipped' },\n },\n ],\n },\n});\n"],"mappings":";;;;AAOA,MAAM,SAAS,CAAC,uBAAuB;;;;AAKvC,MAAa,sBAAsB,cAAc;CAC/C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAe;GAAS;GAAS;EACxC,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EAAE,OAAO;EAAuB,QAAQ;EAAY;CACxD,QAAQ,EAAE,MAAM,QAAQ;CACxB,aAAa;EACX,OAAO,CACL;GACE,KAAK;GACL,SAAS;GACT,MAAM;GACN,SAAS;GACV,CACF;EACD,OAAO,CAAC,4BAA4B;EACrC;CACD,YAAY;EACV,WAAW,CACT;GACE,KAAK;GACL,OAAO,CAAC,wBAAwB;GAChC,MAAM,CAAC,sCAAsC;GAC7C,MAAM,CAAC,oBAAoB,gCAAgC;GAC5D,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO;IACL,SAAS;IACT,OAAO,CAAC;KAAE,WAAW;KAAY,UAAU;KAAG,WAAW;KAAK,CAAC;IAChE;GACD,QAAQ;IAAE,IAAI;IAAa,QAAQ;IAAW,OAAO;IAAK;GAC3D,CACF;EACF;CACF,CAAC;;;;AAKF,MAAa,4BAA4B,cAAc;CACrD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAe;GAAS;GAAS;EACxC,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EAAE,OAAO;EAA6B,QAAQ;EAAY;CAC9D,QAAQ,EAAE,MAAM,QAAQ;CACxB,aAAa;EACX,OAAO,CACL;GACE,KAAK;GACL,SAAS;GACT,MAAM;GACN,SAAS;GACV,CACF;EACD,OAAO,CAAC,kCAAkC;EAC3C;CACD,YAAY;EACV,WAAW,CACT;GACE,KAAK;GACL,OAAO,CAAC,eAAe;GACvB,MAAM,CAAC,8BAA8B;GACrC,MAAM,CAAC,qBAAqB,sCAAsC;GACnE,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO;IACL,SAAS;IACT,QAAQ;IACR,gBAAgB;IACjB;GACD,QAAQ;IAAE,IAAI;IAAa,QAAQ;IAAW;GAC/C,CACF;EACF;CACF,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as _contractspec_lib_contracts12 from "@contractspec/lib.contracts";
|
|
2
|
+
|
|
3
|
+
//#region src/order/order.presentation.d.ts
|
|
4
|
+
declare const OrderListPresentation: _contractspec_lib_contracts12.PresentationSpec;
|
|
5
|
+
declare const OrderDetailPresentation: _contractspec_lib_contracts12.PresentationSpec;
|
|
6
|
+
declare const CheckoutPresentation: _contractspec_lib_contracts12.PresentationSpec;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { CheckoutPresentation, OrderDetailPresentation, OrderListPresentation };
|
|
9
|
+
//# sourceMappingURL=order.presentation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order.presentation.d.ts","names":[],"sources":["../../src/order/order.presentation.ts"],"sourcesContent":[],"mappings":";;;cAGa,uBAuBX,6BAAA,CAvBgC;cAyBrB,yBAwBX,6BAAA,CAxBkC;cA0BvB,sBAuBX,6BAAA,CAvB+B"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { OrderModel } from "./order.schema.js";
|
|
2
|
+
import { StabilityEnum, definePresentation } from "@contractspec/lib.contracts";
|
|
3
|
+
|
|
4
|
+
//#region src/order/order.presentation.ts
|
|
5
|
+
const OrderListPresentation = definePresentation({
|
|
6
|
+
meta: {
|
|
7
|
+
key: "marketplace.order.list",
|
|
8
|
+
version: "1.0.0",
|
|
9
|
+
title: "Order List",
|
|
10
|
+
description: "List of orders with status and tracking",
|
|
11
|
+
domain: "marketplace",
|
|
12
|
+
owners: ["@marketplace-team"],
|
|
13
|
+
tags: [
|
|
14
|
+
"marketplace",
|
|
15
|
+
"order",
|
|
16
|
+
"list"
|
|
17
|
+
],
|
|
18
|
+
stability: StabilityEnum.Experimental,
|
|
19
|
+
goal: "Provide a comprehensive view of all orders for the user.",
|
|
20
|
+
context: "Used in the buyer and seller dashboards to track order progress."
|
|
21
|
+
},
|
|
22
|
+
source: {
|
|
23
|
+
type: "component",
|
|
24
|
+
framework: "react",
|
|
25
|
+
componentKey: "OrderList",
|
|
26
|
+
props: OrderModel
|
|
27
|
+
},
|
|
28
|
+
targets: ["react", "markdown"],
|
|
29
|
+
policy: { flags: ["marketplace.orders.enabled"] }
|
|
30
|
+
});
|
|
31
|
+
const OrderDetailPresentation = definePresentation({
|
|
32
|
+
meta: {
|
|
33
|
+
key: "marketplace.order.detail",
|
|
34
|
+
version: "1.0.0",
|
|
35
|
+
title: "Order Details",
|
|
36
|
+
description: "Order detail with items and shipping info",
|
|
37
|
+
domain: "marketplace",
|
|
38
|
+
owners: ["@marketplace-team"],
|
|
39
|
+
tags: [
|
|
40
|
+
"marketplace",
|
|
41
|
+
"order",
|
|
42
|
+
"detail"
|
|
43
|
+
],
|
|
44
|
+
stability: StabilityEnum.Experimental,
|
|
45
|
+
goal: "Display all details of a single order.",
|
|
46
|
+
context: "Accessed from the order list to see specific items, shipping, and payment details."
|
|
47
|
+
},
|
|
48
|
+
source: {
|
|
49
|
+
type: "component",
|
|
50
|
+
framework: "react",
|
|
51
|
+
componentKey: "OrderDetail",
|
|
52
|
+
props: OrderModel
|
|
53
|
+
},
|
|
54
|
+
targets: ["react", "markdown"],
|
|
55
|
+
policy: { flags: ["marketplace.orders.enabled"] }
|
|
56
|
+
});
|
|
57
|
+
const CheckoutPresentation = definePresentation({
|
|
58
|
+
meta: {
|
|
59
|
+
key: "marketplace.checkout",
|
|
60
|
+
version: "1.0.0",
|
|
61
|
+
title: "Checkout",
|
|
62
|
+
description: "Checkout flow with cart and payment",
|
|
63
|
+
domain: "marketplace",
|
|
64
|
+
owners: ["@marketplace-team"],
|
|
65
|
+
tags: [
|
|
66
|
+
"marketplace",
|
|
67
|
+
"checkout",
|
|
68
|
+
"cart"
|
|
69
|
+
],
|
|
70
|
+
stability: StabilityEnum.Experimental,
|
|
71
|
+
goal: "Guide the user through the payment and order confirmation process.",
|
|
72
|
+
context: "The final stage of the purchasing journey."
|
|
73
|
+
},
|
|
74
|
+
source: {
|
|
75
|
+
type: "component",
|
|
76
|
+
framework: "react",
|
|
77
|
+
componentKey: "Checkout",
|
|
78
|
+
props: OrderModel
|
|
79
|
+
},
|
|
80
|
+
targets: ["react"],
|
|
81
|
+
policy: { flags: ["marketplace.checkout.enabled"] }
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
//#endregion
|
|
85
|
+
export { CheckoutPresentation, OrderDetailPresentation, OrderListPresentation };
|
|
86
|
+
//# sourceMappingURL=order.presentation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order.presentation.js","names":[],"sources":["../../src/order/order.presentation.ts"],"sourcesContent":["import { definePresentation, StabilityEnum } from '@contractspec/lib.contracts';\nimport { OrderModel } from './order.schema';\n\nexport const OrderListPresentation = definePresentation({\n meta: {\n key: 'marketplace.order.list',\n version: '1.0.0',\n title: 'Order List',\n description: 'List of orders with status and tracking',\n domain: 'marketplace',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'order', 'list'],\n stability: StabilityEnum.Experimental,\n goal: 'Provide a comprehensive view of all orders for the user.',\n context: 'Used in the buyer and seller dashboards to track order progress.',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'OrderList',\n props: OrderModel,\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['marketplace.orders.enabled'],\n },\n});\n\nexport const OrderDetailPresentation = definePresentation({\n meta: {\n key: 'marketplace.order.detail',\n version: '1.0.0',\n title: 'Order Details',\n description: 'Order detail with items and shipping info',\n domain: 'marketplace',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'order', 'detail'],\n stability: StabilityEnum.Experimental,\n goal: 'Display all details of a single order.',\n context:\n 'Accessed from the order list to see specific items, shipping, and payment details.',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'OrderDetail',\n props: OrderModel,\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['marketplace.orders.enabled'],\n },\n});\n\nexport const CheckoutPresentation = definePresentation({\n meta: {\n key: 'marketplace.checkout',\n version: '1.0.0',\n title: 'Checkout',\n description: 'Checkout flow with cart and payment',\n domain: 'marketplace',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'checkout', 'cart'],\n stability: StabilityEnum.Experimental,\n goal: 'Guide the user through the payment and order confirmation process.',\n context: 'The final stage of the purchasing journey.',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'Checkout',\n props: OrderModel,\n },\n targets: ['react'],\n policy: {\n flags: ['marketplace.checkout.enabled'],\n },\n});\n"],"mappings":";;;;AAGA,MAAa,wBAAwB,mBAAmB;CACtD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,oBAAoB;EAC7B,MAAM;GAAC;GAAe;GAAS;GAAO;EACtC,WAAW,cAAc;EACzB,MAAM;EACN,SAAS;EACV;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACd,OAAO;EACR;CACD,SAAS,CAAC,SAAS,WAAW;CAC9B,QAAQ,EACN,OAAO,CAAC,6BAA6B,EACtC;CACF,CAAC;AAEF,MAAa,0BAA0B,mBAAmB;CACxD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,oBAAoB;EAC7B,MAAM;GAAC;GAAe;GAAS;GAAS;EACxC,WAAW,cAAc;EACzB,MAAM;EACN,SACE;EACH;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACd,OAAO;EACR;CACD,SAAS,CAAC,SAAS,WAAW;CAC9B,QAAQ,EACN,OAAO,CAAC,6BAA6B,EACtC;CACF,CAAC;AAEF,MAAa,uBAAuB,mBAAmB;CACrD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,oBAAoB;EAC7B,MAAM;GAAC;GAAe;GAAY;GAAO;EACzC,WAAW,cAAc;EACzB,MAAM;EACN,SAAS;EACV;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACd,OAAO;EACR;CACD,SAAS,CAAC,QAAQ;CAClB,QAAQ,EACN,OAAO,CAAC,+BAA+B,EACxC;CACF,CAAC"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import * as _contractspec_lib_schema180 from "@contractspec/lib.schema";
|
|
2
|
+
|
|
3
|
+
//#region src/order/order.schema.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* An order item.
|
|
6
|
+
*/
|
|
7
|
+
declare const OrderItemModel: _contractspec_lib_schema180.SchemaModel<{
|
|
8
|
+
id: {
|
|
9
|
+
type: _contractspec_lib_schema180.FieldType<string, string>;
|
|
10
|
+
isOptional: false;
|
|
11
|
+
};
|
|
12
|
+
productId: {
|
|
13
|
+
type: _contractspec_lib_schema180.FieldType<string, string>;
|
|
14
|
+
isOptional: false;
|
|
15
|
+
};
|
|
16
|
+
productName: {
|
|
17
|
+
type: _contractspec_lib_schema180.FieldType<string, string>;
|
|
18
|
+
isOptional: false;
|
|
19
|
+
};
|
|
20
|
+
unitPrice: {
|
|
21
|
+
type: _contractspec_lib_schema180.FieldType<number, number>;
|
|
22
|
+
isOptional: false;
|
|
23
|
+
};
|
|
24
|
+
quantity: {
|
|
25
|
+
type: _contractspec_lib_schema180.FieldType<number, number>;
|
|
26
|
+
isOptional: false;
|
|
27
|
+
};
|
|
28
|
+
subtotal: {
|
|
29
|
+
type: _contractspec_lib_schema180.FieldType<number, number>;
|
|
30
|
+
isOptional: false;
|
|
31
|
+
};
|
|
32
|
+
}>;
|
|
33
|
+
/**
|
|
34
|
+
* An order.
|
|
35
|
+
*/
|
|
36
|
+
declare const OrderModel: _contractspec_lib_schema180.SchemaModel<{
|
|
37
|
+
id: {
|
|
38
|
+
type: _contractspec_lib_schema180.FieldType<string, string>;
|
|
39
|
+
isOptional: false;
|
|
40
|
+
};
|
|
41
|
+
orderNumber: {
|
|
42
|
+
type: _contractspec_lib_schema180.FieldType<string, string>;
|
|
43
|
+
isOptional: false;
|
|
44
|
+
};
|
|
45
|
+
buyerId: {
|
|
46
|
+
type: _contractspec_lib_schema180.FieldType<string, string>;
|
|
47
|
+
isOptional: false;
|
|
48
|
+
};
|
|
49
|
+
storeId: {
|
|
50
|
+
type: _contractspec_lib_schema180.FieldType<string, string>;
|
|
51
|
+
isOptional: false;
|
|
52
|
+
};
|
|
53
|
+
status: {
|
|
54
|
+
type: _contractspec_lib_schema180.EnumType<[string, string, string, string, string, string, string, string, string, string]>;
|
|
55
|
+
isOptional: false;
|
|
56
|
+
};
|
|
57
|
+
subtotal: {
|
|
58
|
+
type: _contractspec_lib_schema180.FieldType<number, number>;
|
|
59
|
+
isOptional: false;
|
|
60
|
+
};
|
|
61
|
+
shippingTotal: {
|
|
62
|
+
type: _contractspec_lib_schema180.FieldType<number, number>;
|
|
63
|
+
isOptional: false;
|
|
64
|
+
};
|
|
65
|
+
taxTotal: {
|
|
66
|
+
type: _contractspec_lib_schema180.FieldType<number, number>;
|
|
67
|
+
isOptional: false;
|
|
68
|
+
};
|
|
69
|
+
total: {
|
|
70
|
+
type: _contractspec_lib_schema180.FieldType<number, number>;
|
|
71
|
+
isOptional: false;
|
|
72
|
+
};
|
|
73
|
+
currency: {
|
|
74
|
+
type: _contractspec_lib_schema180.FieldType<string, string>;
|
|
75
|
+
isOptional: false;
|
|
76
|
+
};
|
|
77
|
+
items: {
|
|
78
|
+
type: _contractspec_lib_schema180.SchemaModel<{
|
|
79
|
+
id: {
|
|
80
|
+
type: _contractspec_lib_schema180.FieldType<string, string>;
|
|
81
|
+
isOptional: false;
|
|
82
|
+
};
|
|
83
|
+
productId: {
|
|
84
|
+
type: _contractspec_lib_schema180.FieldType<string, string>;
|
|
85
|
+
isOptional: false;
|
|
86
|
+
};
|
|
87
|
+
productName: {
|
|
88
|
+
type: _contractspec_lib_schema180.FieldType<string, string>;
|
|
89
|
+
isOptional: false;
|
|
90
|
+
};
|
|
91
|
+
unitPrice: {
|
|
92
|
+
type: _contractspec_lib_schema180.FieldType<number, number>;
|
|
93
|
+
isOptional: false;
|
|
94
|
+
};
|
|
95
|
+
quantity: {
|
|
96
|
+
type: _contractspec_lib_schema180.FieldType<number, number>;
|
|
97
|
+
isOptional: false;
|
|
98
|
+
};
|
|
99
|
+
subtotal: {
|
|
100
|
+
type: _contractspec_lib_schema180.FieldType<number, number>;
|
|
101
|
+
isOptional: false;
|
|
102
|
+
};
|
|
103
|
+
}>;
|
|
104
|
+
isArray: true;
|
|
105
|
+
isOptional: true;
|
|
106
|
+
};
|
|
107
|
+
createdAt: {
|
|
108
|
+
type: _contractspec_lib_schema180.FieldType<Date, string>;
|
|
109
|
+
isOptional: false;
|
|
110
|
+
};
|
|
111
|
+
}>;
|
|
112
|
+
/**
|
|
113
|
+
* Input for creating an order.
|
|
114
|
+
*/
|
|
115
|
+
declare const CreateOrderInputModel: _contractspec_lib_schema180.SchemaModel<{
|
|
116
|
+
storeId: {
|
|
117
|
+
type: _contractspec_lib_schema180.FieldType<string, string>;
|
|
118
|
+
isOptional: false;
|
|
119
|
+
};
|
|
120
|
+
items: {
|
|
121
|
+
type: _contractspec_lib_schema180.FieldType<unknown, unknown>;
|
|
122
|
+
isOptional: false;
|
|
123
|
+
description: string;
|
|
124
|
+
};
|
|
125
|
+
shippingAddress: {
|
|
126
|
+
type: _contractspec_lib_schema180.FieldType<unknown, unknown>;
|
|
127
|
+
isOptional: true;
|
|
128
|
+
};
|
|
129
|
+
billingAddress: {
|
|
130
|
+
type: _contractspec_lib_schema180.FieldType<unknown, unknown>;
|
|
131
|
+
isOptional: true;
|
|
132
|
+
};
|
|
133
|
+
buyerNote: {
|
|
134
|
+
type: _contractspec_lib_schema180.FieldType<string, string>;
|
|
135
|
+
isOptional: true;
|
|
136
|
+
};
|
|
137
|
+
}>;
|
|
138
|
+
/**
|
|
139
|
+
* Input for updating order status.
|
|
140
|
+
*/
|
|
141
|
+
declare const UpdateOrderStatusInputModel: _contractspec_lib_schema180.SchemaModel<{
|
|
142
|
+
orderId: {
|
|
143
|
+
type: _contractspec_lib_schema180.FieldType<string, string>;
|
|
144
|
+
isOptional: false;
|
|
145
|
+
};
|
|
146
|
+
status: {
|
|
147
|
+
type: _contractspec_lib_schema180.EnumType<[string, string, string, string, string, string, string, string, string, string]>;
|
|
148
|
+
isOptional: false;
|
|
149
|
+
};
|
|
150
|
+
trackingNumber: {
|
|
151
|
+
type: _contractspec_lib_schema180.FieldType<string, string>;
|
|
152
|
+
isOptional: true;
|
|
153
|
+
};
|
|
154
|
+
trackingUrl: {
|
|
155
|
+
type: _contractspec_lib_schema180.FieldType<string, string>;
|
|
156
|
+
isOptional: true;
|
|
157
|
+
};
|
|
158
|
+
note: {
|
|
159
|
+
type: _contractspec_lib_schema180.FieldType<string, string>;
|
|
160
|
+
isOptional: true;
|
|
161
|
+
};
|
|
162
|
+
}>;
|
|
163
|
+
//#endregion
|
|
164
|
+
export { CreateOrderInputModel, OrderItemModel, OrderModel, UpdateOrderStatusInputModel };
|
|
165
|
+
//# sourceMappingURL=order.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order.schema.d.ts","names":[],"sources":["../../src/order/order.schema.ts"],"sourcesContent":[],"mappings":";;;;;;AAMa,cAAA,cAUX,8BAVyB,WAUzB,CAAA;EAAA,EAAA,EAAA;UAAA,2BAAA,CAAA;;;;;;EAVyB,CAAA;EAed,WAAA,EAiBX;IAAA,IAAA,uCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;;;;;;;;;;;;;;;;;;;cAjBW,UAAU,8BAAA,WAAA,CAAA;EAAA,EAAA,EAAA;IAsBV,IAAA,EALX,2BAAA,CAAA,SAkBA,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;;;;;;EAbgC,OAAA,EAAA;IAkBrB,IAAA,uCAYX,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;;;;;;EAZsC,MAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAlB3B,mDAAqB;;UAahC,2BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;cAKW,yDAA2B;;UAYtC,2BAAA,CAAA"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { OrderStatusEnum } from "./order.enum.js";
|
|
2
|
+
import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
|
|
3
|
+
|
|
4
|
+
//#region src/order/order.schema.ts
|
|
5
|
+
/**
|
|
6
|
+
* An order item.
|
|
7
|
+
*/
|
|
8
|
+
const OrderItemModel = defineSchemaModel({
|
|
9
|
+
name: "OrderItemModel",
|
|
10
|
+
fields: {
|
|
11
|
+
id: {
|
|
12
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
13
|
+
isOptional: false
|
|
14
|
+
},
|
|
15
|
+
productId: {
|
|
16
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
17
|
+
isOptional: false
|
|
18
|
+
},
|
|
19
|
+
productName: {
|
|
20
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
21
|
+
isOptional: false
|
|
22
|
+
},
|
|
23
|
+
unitPrice: {
|
|
24
|
+
type: ScalarTypeEnum.Float_unsecure(),
|
|
25
|
+
isOptional: false
|
|
26
|
+
},
|
|
27
|
+
quantity: {
|
|
28
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
29
|
+
isOptional: false
|
|
30
|
+
},
|
|
31
|
+
subtotal: {
|
|
32
|
+
type: ScalarTypeEnum.Float_unsecure(),
|
|
33
|
+
isOptional: false
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* An order.
|
|
39
|
+
*/
|
|
40
|
+
const OrderModel = defineSchemaModel({
|
|
41
|
+
name: "OrderModel",
|
|
42
|
+
description: "An order",
|
|
43
|
+
fields: {
|
|
44
|
+
id: {
|
|
45
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
46
|
+
isOptional: false
|
|
47
|
+
},
|
|
48
|
+
orderNumber: {
|
|
49
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
50
|
+
isOptional: false
|
|
51
|
+
},
|
|
52
|
+
buyerId: {
|
|
53
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
54
|
+
isOptional: false
|
|
55
|
+
},
|
|
56
|
+
storeId: {
|
|
57
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
58
|
+
isOptional: false
|
|
59
|
+
},
|
|
60
|
+
status: {
|
|
61
|
+
type: OrderStatusEnum,
|
|
62
|
+
isOptional: false
|
|
63
|
+
},
|
|
64
|
+
subtotal: {
|
|
65
|
+
type: ScalarTypeEnum.Float_unsecure(),
|
|
66
|
+
isOptional: false
|
|
67
|
+
},
|
|
68
|
+
shippingTotal: {
|
|
69
|
+
type: ScalarTypeEnum.Float_unsecure(),
|
|
70
|
+
isOptional: false
|
|
71
|
+
},
|
|
72
|
+
taxTotal: {
|
|
73
|
+
type: ScalarTypeEnum.Float_unsecure(),
|
|
74
|
+
isOptional: false
|
|
75
|
+
},
|
|
76
|
+
total: {
|
|
77
|
+
type: ScalarTypeEnum.Float_unsecure(),
|
|
78
|
+
isOptional: false
|
|
79
|
+
},
|
|
80
|
+
currency: {
|
|
81
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
82
|
+
isOptional: false
|
|
83
|
+
},
|
|
84
|
+
items: {
|
|
85
|
+
type: OrderItemModel,
|
|
86
|
+
isArray: true,
|
|
87
|
+
isOptional: true
|
|
88
|
+
},
|
|
89
|
+
createdAt: {
|
|
90
|
+
type: ScalarTypeEnum.DateTime(),
|
|
91
|
+
isOptional: false
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
/**
|
|
96
|
+
* Input for creating an order.
|
|
97
|
+
*/
|
|
98
|
+
const CreateOrderInputModel = defineSchemaModel({
|
|
99
|
+
name: "CreateOrderInput",
|
|
100
|
+
fields: {
|
|
101
|
+
storeId: {
|
|
102
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
103
|
+
isOptional: false
|
|
104
|
+
},
|
|
105
|
+
items: {
|
|
106
|
+
type: ScalarTypeEnum.JSON(),
|
|
107
|
+
isOptional: false,
|
|
108
|
+
description: "Array of {productId, variantId?, quantity}"
|
|
109
|
+
},
|
|
110
|
+
shippingAddress: {
|
|
111
|
+
type: ScalarTypeEnum.JSON(),
|
|
112
|
+
isOptional: true
|
|
113
|
+
},
|
|
114
|
+
billingAddress: {
|
|
115
|
+
type: ScalarTypeEnum.JSON(),
|
|
116
|
+
isOptional: true
|
|
117
|
+
},
|
|
118
|
+
buyerNote: {
|
|
119
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
120
|
+
isOptional: true
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
/**
|
|
125
|
+
* Input for updating order status.
|
|
126
|
+
*/
|
|
127
|
+
const UpdateOrderStatusInputModel = defineSchemaModel({
|
|
128
|
+
name: "UpdateOrderStatusInput",
|
|
129
|
+
fields: {
|
|
130
|
+
orderId: {
|
|
131
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
132
|
+
isOptional: false
|
|
133
|
+
},
|
|
134
|
+
status: {
|
|
135
|
+
type: OrderStatusEnum,
|
|
136
|
+
isOptional: false
|
|
137
|
+
},
|
|
138
|
+
trackingNumber: {
|
|
139
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
140
|
+
isOptional: true
|
|
141
|
+
},
|
|
142
|
+
trackingUrl: {
|
|
143
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
144
|
+
isOptional: true
|
|
145
|
+
},
|
|
146
|
+
note: {
|
|
147
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
148
|
+
isOptional: true
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
//#endregion
|
|
154
|
+
export { CreateOrderInputModel, OrderItemModel, OrderModel, UpdateOrderStatusInputModel };
|
|
155
|
+
//# sourceMappingURL=order.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order.schema.js","names":[],"sources":["../../src/order/order.schema.ts"],"sourcesContent":["import { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';\nimport { OrderStatusEnum } from './order.enum';\n\n/**\n * An order item.\n */\nexport const OrderItemModel = defineSchemaModel({\n name: 'OrderItemModel',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n productId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n productName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n unitPrice: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n quantity: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n subtotal: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n },\n});\n\n/**\n * An order.\n */\nexport const OrderModel = defineSchemaModel({\n name: 'OrderModel',\n description: 'An order',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n orderNumber: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n buyerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: OrderStatusEnum, isOptional: false },\n subtotal: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n shippingTotal: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n taxTotal: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n total: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n items: { type: OrderItemModel, isArray: true, isOptional: true },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * Input for creating an order.\n */\nexport const CreateOrderInputModel = defineSchemaModel({\n name: 'CreateOrderInput',\n fields: {\n storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n items: {\n type: ScalarTypeEnum.JSON(),\n isOptional: false,\n description: 'Array of {productId, variantId?, quantity}',\n },\n shippingAddress: { type: ScalarTypeEnum.JSON(), isOptional: true },\n billingAddress: { type: ScalarTypeEnum.JSON(), isOptional: true },\n buyerNote: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n\n/**\n * Input for updating order status.\n */\nexport const UpdateOrderStatusInputModel = defineSchemaModel({\n name: 'UpdateOrderStatusInput',\n fields: {\n orderId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: OrderStatusEnum, isOptional: false },\n trackingNumber: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n trackingUrl: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n note: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n"],"mappings":";;;;;;;AAMA,MAAa,iBAAiB,kBAAkB;CAC9C,MAAM;CACN,QAAQ;EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACxE,aAAa;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC1E,WAAW;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EACvE,UAAU;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EACpE,UAAU;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EACvE;CACF,CAAC;;;;AAKF,MAAa,aAAa,kBAAkB;CAC1C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,aAAa;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC1E,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,QAAQ;GAAE,MAAM;GAAiB,YAAY;GAAO;EACpD,UAAU;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EACtE,eAAe;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EAC3E,UAAU;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EACtE,OAAO;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EACnE,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACvE,OAAO;GAAE,MAAM;GAAgB,SAAS;GAAM,YAAY;GAAM;EAChE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;;;;AAKF,MAAa,wBAAwB,kBAAkB;CACrD,MAAM;CACN,QAAQ;EACN,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,OAAO;GACL,MAAM,eAAe,MAAM;GAC3B,YAAY;GACZ,aAAa;GACd;EACD,iBAAiB;GAAE,MAAM,eAAe,MAAM;GAAE,YAAY;GAAM;EAClE,gBAAgB;GAAE,MAAM,eAAe,MAAM;GAAE,YAAY;GAAM;EACjE,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACxE;CACF,CAAC;;;;AAKF,MAAa,8BAA8B,kBAAkB;CAC3D,MAAM;CACN,QAAQ;EACN,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,QAAQ;GAAE,MAAM;GAAiB,YAAY;GAAO;EACpD,gBAAgB;GACd,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,aAAa;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACzE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACnE;CACF,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PayoutStatusEnum } from "./payout.enum.js";
|
|
2
|
+
import { ListPayoutsInputModel, ListPayoutsOutputModel, PayoutModel } from "./payout.schema.js";
|
|
3
|
+
import { ListPayoutsContract } from "./payout.operations.js";
|
|
4
|
+
import { PayoutCreatedEvent, PayoutPaidEvent } from "./payout.event.js";
|
|
5
|
+
export { ListPayoutsContract, ListPayoutsInputModel, ListPayoutsOutputModel, PayoutCreatedEvent, PayoutModel, PayoutPaidEvent, PayoutStatusEnum };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PayoutStatusEnum } from "./payout.enum.js";
|
|
2
|
+
import { ListPayoutsInputModel, ListPayoutsOutputModel, PayoutModel } from "./payout.schema.js";
|
|
3
|
+
import { ListPayoutsContract } from "./payout.operations.js";
|
|
4
|
+
import { PayoutCreatedEvent, PayoutPaidEvent } from "./payout.event.js";
|
|
5
|
+
|
|
6
|
+
export { ListPayoutsContract, ListPayoutsInputModel, ListPayoutsOutputModel, PayoutCreatedEvent, PayoutModel, PayoutPaidEvent, PayoutStatusEnum };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as _contractspec_lib_schema284 from "@contractspec/lib.schema";
|
|
2
|
+
|
|
3
|
+
//#region src/payout/payout.enum.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Payout status enum.
|
|
6
|
+
*/
|
|
7
|
+
declare const PayoutStatusEnum: _contractspec_lib_schema284.EnumType<[string, string, string, string, string]>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { PayoutStatusEnum };
|
|
10
|
+
//# sourceMappingURL=payout.enum.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payout.enum.d.ts","names":[],"sources":["../../src/payout/payout.enum.ts"],"sourcesContent":[],"mappings":";;;;;;AAKa,cAAA,gBAMX,EAAA,2BAAA,CAN2B,QAAA,CAAA,CAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineEnum } from "@contractspec/lib.schema";
|
|
2
|
+
|
|
3
|
+
//#region src/payout/payout.enum.ts
|
|
4
|
+
/**
|
|
5
|
+
* Payout status enum.
|
|
6
|
+
*/
|
|
7
|
+
const PayoutStatusEnum = defineEnum("PayoutStatus", [
|
|
8
|
+
"PENDING",
|
|
9
|
+
"PROCESSING",
|
|
10
|
+
"PAID",
|
|
11
|
+
"FAILED",
|
|
12
|
+
"CANCELLED"
|
|
13
|
+
]);
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { PayoutStatusEnum };
|
|
17
|
+
//# sourceMappingURL=payout.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payout.enum.js","names":[],"sources":["../../src/payout/payout.enum.ts"],"sourcesContent":["import { defineEnum } from '@contractspec/lib.schema';\n\n/**\n * Payout status enum.\n */\nexport const PayoutStatusEnum = defineEnum('PayoutStatus', [\n 'PENDING',\n 'PROCESSING',\n 'PAID',\n 'FAILED',\n 'CANCELLED',\n]);\n"],"mappings":";;;;;;AAKA,MAAa,mBAAmB,WAAW,gBAAgB;CACzD;CACA;CACA;CACA;CACA;CACD,CAAC"}
|