@almadar/std 2.1.1 → 2.4.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/behaviors/async.d.ts +12 -7
- package/dist/behaviors/async.js +1085 -312
- package/dist/behaviors/async.js.map +1 -1
- package/dist/behaviors/data-management.d.ts +27 -13
- package/dist/behaviors/data-management.js +600 -244
- package/dist/behaviors/data-management.js.map +1 -1
- package/dist/behaviors/domain/commerce.d.ts +51 -0
- package/dist/behaviors/domain/commerce.js +1093 -0
- package/dist/behaviors/domain/commerce.js.map +1 -0
- package/dist/behaviors/domain/content.d.ts +51 -0
- package/dist/behaviors/domain/content.js +1294 -0
- package/dist/behaviors/domain/content.js.map +1 -0
- package/dist/behaviors/domain/dashboard.d.ts +45 -0
- package/dist/behaviors/domain/dashboard.js +783 -0
- package/dist/behaviors/domain/dashboard.js.map +1 -0
- package/dist/behaviors/domain/education.d.ts +41 -0
- package/dist/behaviors/domain/education.js +738 -0
- package/dist/behaviors/domain/education.js.map +1 -0
- package/dist/behaviors/domain/finance.d.ts +49 -0
- package/dist/behaviors/domain/finance.js +660 -0
- package/dist/behaviors/domain/finance.js.map +1 -0
- package/dist/behaviors/domain/game-2d-platformer.d.ts +50 -0
- package/dist/behaviors/domain/game-2d-platformer.js +810 -0
- package/dist/behaviors/domain/game-2d-platformer.js.map +1 -0
- package/dist/behaviors/domain/game-2d-puzzle.d.ts +42 -0
- package/dist/behaviors/domain/game-2d-puzzle.js +622 -0
- package/dist/behaviors/domain/game-2d-puzzle.js.map +1 -0
- package/dist/behaviors/domain/game-2d-rpg.d.ts +48 -0
- package/dist/behaviors/domain/game-2d-rpg.js +860 -0
- package/dist/behaviors/domain/game-2d-rpg.js.map +1 -0
- package/dist/behaviors/domain/game-2d-strategy.d.ts +48 -0
- package/dist/behaviors/domain/game-2d-strategy.js +692 -0
- package/dist/behaviors/domain/game-2d-strategy.js.map +1 -0
- package/dist/behaviors/domain/geospatial.d.ts +35 -0
- package/dist/behaviors/domain/geospatial.js +634 -0
- package/dist/behaviors/domain/geospatial.js.map +1 -0
- package/dist/behaviors/domain/healthcare.d.ts +36 -0
- package/dist/behaviors/domain/healthcare.js +1068 -0
- package/dist/behaviors/domain/healthcare.js.map +1 -0
- package/dist/behaviors/domain/iot.d.ts +45 -0
- package/dist/behaviors/domain/iot.js +589 -0
- package/dist/behaviors/domain/iot.js.map +1 -0
- package/dist/behaviors/domain/media.d.ts +41 -0
- package/dist/behaviors/domain/media.js +771 -0
- package/dist/behaviors/domain/media.js.map +1 -0
- package/dist/behaviors/domain/scheduling.d.ts +41 -0
- package/dist/behaviors/domain/scheduling.js +930 -0
- package/dist/behaviors/domain/scheduling.js.map +1 -0
- package/dist/behaviors/domain/simulation.d.ts +36 -0
- package/dist/behaviors/domain/simulation.js +706 -0
- package/dist/behaviors/domain/simulation.js.map +1 -0
- package/dist/behaviors/domain/social.d.ts +41 -0
- package/dist/behaviors/domain/social.js +840 -0
- package/dist/behaviors/domain/social.js.map +1 -0
- package/dist/behaviors/domain/workflow.d.ts +41 -0
- package/dist/behaviors/domain/workflow.js +879 -0
- package/dist/behaviors/domain/workflow.js.map +1 -0
- package/dist/behaviors/feedback.d.ts +10 -5
- package/dist/behaviors/feedback.js +279 -194
- package/dist/behaviors/feedback.js.map +1 -1
- package/dist/behaviors/game-core.d.ts +15 -8
- package/dist/behaviors/game-core.js +412 -80
- package/dist/behaviors/game-core.js.map +1 -1
- package/dist/behaviors/game-entity.d.ts +17 -10
- package/dist/behaviors/game-entity.js +544 -237
- package/dist/behaviors/game-entity.js.map +1 -1
- package/dist/behaviors/game-ui.d.ts +16 -8
- package/dist/behaviors/game-ui.js +451 -316
- package/dist/behaviors/game-ui.js.map +1 -1
- package/dist/behaviors/index.d.ts +18 -1
- package/dist/behaviors/index.js +18905 -2140
- package/dist/behaviors/index.js.map +1 -1
- package/dist/behaviors/infrastructure.d.ts +9 -8
- package/dist/behaviors/infrastructure.js +597 -169
- package/dist/behaviors/infrastructure.js.map +1 -1
- package/dist/behaviors/registry.d.ts +11 -11
- package/dist/behaviors/registry.js +18904 -2139
- package/dist/behaviors/registry.js.map +1 -1
- package/dist/behaviors/types.d.ts +19 -2
- package/dist/behaviors/types.js.map +1 -1
- package/dist/behaviors/ui-interaction.d.ts +20 -14
- package/dist/behaviors/ui-interaction.js +928 -518
- package/dist/behaviors/ui-interaction.js.map +1 -1
- package/dist/index.js +18906 -2141
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,1093 @@
|
|
|
1
|
+
// behaviors/domain/commerce.ts
|
|
2
|
+
var COMMERCE_THEME = {
|
|
3
|
+
name: "commerce-indigo",
|
|
4
|
+
tokens: {
|
|
5
|
+
colors: {
|
|
6
|
+
primary: "#6366f1",
|
|
7
|
+
"primary-hover": "#4f46e5",
|
|
8
|
+
"primary-foreground": "#ffffff",
|
|
9
|
+
accent: "#ec4899",
|
|
10
|
+
"accent-foreground": "#ffffff",
|
|
11
|
+
success: "#22c55e",
|
|
12
|
+
warning: "#f59e0b",
|
|
13
|
+
error: "#ef4444"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var cartHasItemsMainEffect = ["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
|
|
18
|
+
// Header: cart icon + title + checkout button
|
|
19
|
+
{ type: "stack", direction: "horizontal", justify: "space-between", children: [
|
|
20
|
+
{ type: "stack", direction: "horizontal", gap: "sm", children: [
|
|
21
|
+
{ type: "icon", name: "shopping-cart", size: "lg" },
|
|
22
|
+
{ type: "typography", variant: "h2", content: "Shopping Cart" }
|
|
23
|
+
] },
|
|
24
|
+
{ type: "stack", direction: "horizontal", gap: "sm", children: [
|
|
25
|
+
{ type: "button", label: "Add Item", icon: "plus", variant: "secondary", action: "ADD_ITEM" },
|
|
26
|
+
{ type: "button", label: "Checkout", icon: "credit-card", variant: "primary", action: "PROCEED_CHECKOUT" }
|
|
27
|
+
] }
|
|
28
|
+
] },
|
|
29
|
+
{ type: "divider" },
|
|
30
|
+
// Stats: cart total
|
|
31
|
+
{ type: "stats", label: "Cart Total", icon: "dollar-sign", value: "@entity.price" },
|
|
32
|
+
{ type: "divider" },
|
|
33
|
+
// Item list
|
|
34
|
+
{
|
|
35
|
+
type: "data-list",
|
|
36
|
+
entity: "CartItem",
|
|
37
|
+
variant: "card",
|
|
38
|
+
fields: [
|
|
39
|
+
{ name: "name", label: "Item", icon: "package", variant: "h4" },
|
|
40
|
+
{ name: "price", label: "Price", icon: "dollar-sign", variant: "body", format: "currency" },
|
|
41
|
+
{ name: "quantity", label: "Qty", icon: "hash", variant: "badge" },
|
|
42
|
+
{ name: "productId", label: "Product ID", variant: "caption" }
|
|
43
|
+
],
|
|
44
|
+
itemActions: [
|
|
45
|
+
{ label: "Remove", event: "REMOVE_ITEM", icon: "trash-2", variant: "danger" }
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
] }];
|
|
49
|
+
var CART_BEHAVIOR = {
|
|
50
|
+
name: "std-cart",
|
|
51
|
+
version: "1.0.0",
|
|
52
|
+
description: "Shopping cart with add/remove items and checkout",
|
|
53
|
+
theme: COMMERCE_THEME,
|
|
54
|
+
orbitals: [
|
|
55
|
+
{
|
|
56
|
+
name: "CartOrbital",
|
|
57
|
+
entity: {
|
|
58
|
+
name: "CartItem",
|
|
59
|
+
persistence: "persistent",
|
|
60
|
+
collection: "cart_items",
|
|
61
|
+
fields: [
|
|
62
|
+
{ name: "id", type: "string", required: true },
|
|
63
|
+
{ name: "name", type: "string", default: "" },
|
|
64
|
+
{ name: "price", type: "number", default: 0 },
|
|
65
|
+
{ name: "quantity", type: "number", default: 1 },
|
|
66
|
+
{ name: "productId", type: "string", default: "" }
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
traits: [
|
|
70
|
+
{
|
|
71
|
+
name: "CartControl",
|
|
72
|
+
linkedEntity: "CartItem",
|
|
73
|
+
category: "interaction",
|
|
74
|
+
stateMachine: {
|
|
75
|
+
states: [
|
|
76
|
+
{ name: "empty", isInitial: true },
|
|
77
|
+
{ name: "hasItems" },
|
|
78
|
+
{ name: "creating" },
|
|
79
|
+
{ name: "checkout" }
|
|
80
|
+
],
|
|
81
|
+
events: [
|
|
82
|
+
{ key: "INIT", name: "Initialize" },
|
|
83
|
+
{ key: "ADD_ITEM", name: "Add Item" },
|
|
84
|
+
{ key: "REMOVE_ITEM", name: "Remove Item", payloadSchema: [
|
|
85
|
+
{ name: "id", type: "string", required: true }
|
|
86
|
+
] },
|
|
87
|
+
{ key: "SAVE", name: "Save Item", payloadSchema: [
|
|
88
|
+
{ name: "data", type: "object", required: true }
|
|
89
|
+
] },
|
|
90
|
+
{ key: "CANCEL", name: "Cancel" },
|
|
91
|
+
{ key: "CLOSE", name: "Close" },
|
|
92
|
+
{ key: "PROCEED_CHECKOUT", name: "Proceed to Checkout" },
|
|
93
|
+
{ key: "BACK_TO_CART", name: "Back to Cart" },
|
|
94
|
+
{ key: "VIEW", name: "View Item", payloadSchema: [{ name: "id", type: "string", required: true }] }
|
|
95
|
+
],
|
|
96
|
+
transitions: [
|
|
97
|
+
{
|
|
98
|
+
from: "empty",
|
|
99
|
+
to: "empty",
|
|
100
|
+
event: "INIT",
|
|
101
|
+
effects: [
|
|
102
|
+
["fetch", "CartItem"],
|
|
103
|
+
["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
|
|
104
|
+
// Header
|
|
105
|
+
{ type: "stack", direction: "horizontal", justify: "space-between", children: [
|
|
106
|
+
{ type: "stack", direction: "horizontal", gap: "sm", children: [
|
|
107
|
+
{ type: "icon", name: "shopping-cart", size: "lg" },
|
|
108
|
+
{ type: "typography", variant: "h2", content: "Shopping Cart" }
|
|
109
|
+
] },
|
|
110
|
+
{ type: "button", label: "Add Item", icon: "plus", variant: "primary", action: "ADD_ITEM" }
|
|
111
|
+
] },
|
|
112
|
+
{ type: "divider" },
|
|
113
|
+
// Stats
|
|
114
|
+
{ type: "stats", label: "Total", icon: "dollar-sign", value: "@entity.price" },
|
|
115
|
+
{ type: "divider" },
|
|
116
|
+
// Empty state: icon + message
|
|
117
|
+
{ type: "stack", direction: "vertical", gap: "md", align: "center", children: [
|
|
118
|
+
{ type: "icon", name: "shopping-cart", size: "xl" },
|
|
119
|
+
{ type: "typography", variant: "h3", content: "Your cart is empty" },
|
|
120
|
+
{ type: "typography", variant: "body", content: "Add items to get started" }
|
|
121
|
+
] }
|
|
122
|
+
] }]
|
|
123
|
+
]
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
from: "hasItems",
|
|
127
|
+
to: "hasItems",
|
|
128
|
+
event: "INIT",
|
|
129
|
+
effects: [
|
|
130
|
+
["fetch", "CartItem"],
|
|
131
|
+
...[cartHasItemsMainEffect]
|
|
132
|
+
]
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
from: "empty",
|
|
136
|
+
to: "creating",
|
|
137
|
+
event: "ADD_ITEM",
|
|
138
|
+
effects: [
|
|
139
|
+
["render-ui", "modal", { type: "form-section", entity: "CartItem", fields: [
|
|
140
|
+
{ name: "name", label: "Item Name", type: "string", required: true },
|
|
141
|
+
{ name: "price", label: "Price", type: "number", required: true },
|
|
142
|
+
{ name: "quantity", label: "Quantity", type: "number", required: true },
|
|
143
|
+
{ name: "productId", label: "Product ID", type: "string", required: true }
|
|
144
|
+
], submitEvent: "SAVE", cancelEvent: "CANCEL" }]
|
|
145
|
+
]
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
from: "hasItems",
|
|
149
|
+
to: "creating",
|
|
150
|
+
event: "ADD_ITEM",
|
|
151
|
+
effects: [
|
|
152
|
+
["render-ui", "modal", { type: "form-section", entity: "CartItem", fields: [
|
|
153
|
+
{ name: "name", label: "Item Name", type: "string", required: true },
|
|
154
|
+
{ name: "price", label: "Price", type: "number", required: true },
|
|
155
|
+
{ name: "quantity", label: "Quantity", type: "number", required: true },
|
|
156
|
+
{ name: "productId", label: "Product ID", type: "string", required: true }
|
|
157
|
+
], submitEvent: "SAVE", cancelEvent: "CANCEL" }]
|
|
158
|
+
]
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
from: "creating",
|
|
162
|
+
to: "hasItems",
|
|
163
|
+
event: "SAVE",
|
|
164
|
+
effects: [
|
|
165
|
+
["persist", "create", "CartItem", "@payload.data"],
|
|
166
|
+
["fetch", "CartItem"],
|
|
167
|
+
...[cartHasItemsMainEffect],
|
|
168
|
+
["render-ui", "modal", null]
|
|
169
|
+
]
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
from: "creating",
|
|
173
|
+
to: "hasItems",
|
|
174
|
+
event: "CANCEL",
|
|
175
|
+
effects: [
|
|
176
|
+
["fetch", "CartItem"],
|
|
177
|
+
...[cartHasItemsMainEffect],
|
|
178
|
+
["render-ui", "modal", null]
|
|
179
|
+
]
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
from: "creating",
|
|
183
|
+
to: "hasItems",
|
|
184
|
+
event: "CLOSE",
|
|
185
|
+
effects: [
|
|
186
|
+
["fetch", "CartItem"],
|
|
187
|
+
...[cartHasItemsMainEffect],
|
|
188
|
+
["render-ui", "modal", null]
|
|
189
|
+
]
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
from: "hasItems",
|
|
193
|
+
to: "hasItems",
|
|
194
|
+
event: "REMOVE_ITEM",
|
|
195
|
+
effects: [
|
|
196
|
+
["fetch", "CartItem"],
|
|
197
|
+
...[cartHasItemsMainEffect]
|
|
198
|
+
]
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
from: "hasItems",
|
|
202
|
+
to: "checkout",
|
|
203
|
+
event: "PROCEED_CHECKOUT",
|
|
204
|
+
effects: [
|
|
205
|
+
["fetch", "CartItem"],
|
|
206
|
+
["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
|
|
207
|
+
// Header: credit-card icon + title + back
|
|
208
|
+
{ type: "stack", direction: "horizontal", justify: "space-between", children: [
|
|
209
|
+
{ type: "stack", direction: "horizontal", gap: "sm", children: [
|
|
210
|
+
{ type: "icon", name: "credit-card", size: "lg" },
|
|
211
|
+
{ type: "typography", variant: "h2", content: "Checkout" }
|
|
212
|
+
] },
|
|
213
|
+
{ type: "button", label: "Back to Cart", icon: "arrow-left", variant: "secondary", action: "BACK_TO_CART" }
|
|
214
|
+
] },
|
|
215
|
+
{ type: "divider" },
|
|
216
|
+
// Order summary
|
|
217
|
+
{ type: "typography", variant: "h3", content: "Order Summary" },
|
|
218
|
+
{ type: "stats", label: "Cart Total", icon: "dollar-sign", value: "@entity.price" },
|
|
219
|
+
{ type: "divider" },
|
|
220
|
+
// Order items (read-only)
|
|
221
|
+
{
|
|
222
|
+
type: "data-list",
|
|
223
|
+
entity: "CartItem",
|
|
224
|
+
variant: "compact",
|
|
225
|
+
fields: [
|
|
226
|
+
{ name: "name", label: "Item", icon: "package", variant: "h4" },
|
|
227
|
+
{ name: "price", label: "Price", icon: "dollar-sign", variant: "body", format: "currency" },
|
|
228
|
+
{ name: "quantity", label: "Qty", icon: "hash", variant: "badge" }
|
|
229
|
+
],
|
|
230
|
+
itemActions: [
|
|
231
|
+
{ label: "View", event: "VIEW", icon: "eye" }
|
|
232
|
+
]
|
|
233
|
+
}
|
|
234
|
+
] }]
|
|
235
|
+
]
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
from: "checkout",
|
|
239
|
+
to: "checkout",
|
|
240
|
+
event: "VIEW",
|
|
241
|
+
effects: [
|
|
242
|
+
["fetch", "CartItem"],
|
|
243
|
+
["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
|
|
244
|
+
{ type: "stack", direction: "horizontal", gap: "sm", children: [
|
|
245
|
+
{ type: "icon", name: "credit-card", size: "lg" },
|
|
246
|
+
{ type: "typography", variant: "h2", content: "Checkout" }
|
|
247
|
+
] },
|
|
248
|
+
{ type: "divider" },
|
|
249
|
+
{
|
|
250
|
+
type: "data-list",
|
|
251
|
+
entity: "CartItem",
|
|
252
|
+
variant: "compact",
|
|
253
|
+
fields: [
|
|
254
|
+
{ name: "name", label: "Item", icon: "package", variant: "h4" },
|
|
255
|
+
{ name: "price", label: "Price", icon: "dollar-sign", variant: "body", format: "currency" },
|
|
256
|
+
{ name: "quantity", label: "Qty", icon: "hash", variant: "badge" }
|
|
257
|
+
],
|
|
258
|
+
itemActions: [
|
|
259
|
+
{ label: "View", event: "VIEW", icon: "eye" }
|
|
260
|
+
]
|
|
261
|
+
}
|
|
262
|
+
] }]
|
|
263
|
+
]
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
from: "checkout",
|
|
267
|
+
to: "hasItems",
|
|
268
|
+
event: "BACK_TO_CART",
|
|
269
|
+
effects: [
|
|
270
|
+
["fetch", "CartItem"],
|
|
271
|
+
...[cartHasItemsMainEffect]
|
|
272
|
+
]
|
|
273
|
+
}
|
|
274
|
+
]
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
],
|
|
278
|
+
pages: [
|
|
279
|
+
{
|
|
280
|
+
name: "CartPage",
|
|
281
|
+
path: "/cart",
|
|
282
|
+
isInitial: true,
|
|
283
|
+
traits: [{ ref: "CartControl" }]
|
|
284
|
+
}
|
|
285
|
+
]
|
|
286
|
+
}
|
|
287
|
+
]
|
|
288
|
+
};
|
|
289
|
+
var checkoutWizardSteps = [
|
|
290
|
+
{ label: "Shipping", icon: "truck" },
|
|
291
|
+
{ label: "Payment", icon: "credit-card" },
|
|
292
|
+
{ label: "Review", icon: "clipboard-check" }
|
|
293
|
+
];
|
|
294
|
+
var checkoutShippingMainEffect = ["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
|
|
295
|
+
// Wizard progress
|
|
296
|
+
{ type: "wizard-progress", currentStep: 0, steps: checkoutWizardSteps },
|
|
297
|
+
{ type: "divider" },
|
|
298
|
+
// Step header
|
|
299
|
+
{ type: "stack", direction: "horizontal", gap: "sm", children: [
|
|
300
|
+
{ type: "icon", name: "truck", size: "md" },
|
|
301
|
+
{ type: "typography", variant: "h3", content: "Shipping Address" }
|
|
302
|
+
] },
|
|
303
|
+
// Form
|
|
304
|
+
{
|
|
305
|
+
type: "form-section",
|
|
306
|
+
entity: "Order",
|
|
307
|
+
submitEvent: "SET_SHIPPING",
|
|
308
|
+
fields: [
|
|
309
|
+
{ name: "shippingAddress", label: "Shipping Address", icon: "map-pin" }
|
|
310
|
+
]
|
|
311
|
+
}
|
|
312
|
+
] }];
|
|
313
|
+
var checkoutPaymentMainEffect = ["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
|
|
314
|
+
// Wizard progress
|
|
315
|
+
{ type: "wizard-progress", currentStep: 1, steps: checkoutWizardSteps },
|
|
316
|
+
{ type: "divider" },
|
|
317
|
+
// Step header
|
|
318
|
+
{ type: "stack", direction: "horizontal", gap: "sm", children: [
|
|
319
|
+
{ type: "icon", name: "credit-card", size: "md" },
|
|
320
|
+
{ type: "typography", variant: "h3", content: "Payment Method" }
|
|
321
|
+
] },
|
|
322
|
+
// Back button
|
|
323
|
+
{ type: "button", label: "Back to Shipping", icon: "arrow-left", variant: "ghost", action: "BACK_TO_SHIPPING" },
|
|
324
|
+
// Form
|
|
325
|
+
{
|
|
326
|
+
type: "form-section",
|
|
327
|
+
entity: "Order",
|
|
328
|
+
submitEvent: "SET_PAYMENT",
|
|
329
|
+
fields: [
|
|
330
|
+
{ name: "paymentMethod", label: "Payment Method", icon: "wallet" }
|
|
331
|
+
]
|
|
332
|
+
}
|
|
333
|
+
] }];
|
|
334
|
+
var CHECKOUT_BEHAVIOR = {
|
|
335
|
+
name: "std-checkout",
|
|
336
|
+
version: "1.0.0",
|
|
337
|
+
description: "Multi-step checkout flow with shipping, payment, and review",
|
|
338
|
+
theme: COMMERCE_THEME,
|
|
339
|
+
orbitals: [
|
|
340
|
+
{
|
|
341
|
+
name: "CheckoutOrbital",
|
|
342
|
+
entity: {
|
|
343
|
+
name: "Order",
|
|
344
|
+
persistence: "persistent",
|
|
345
|
+
collection: "orders",
|
|
346
|
+
fields: [
|
|
347
|
+
{ name: "id", type: "string", required: true },
|
|
348
|
+
{ name: "total", type: "number", default: 0 },
|
|
349
|
+
{ name: "status", type: "string", default: "pending" },
|
|
350
|
+
{ name: "shippingAddress", type: "string", default: "" },
|
|
351
|
+
{ name: "paymentMethod", type: "string", default: "" }
|
|
352
|
+
]
|
|
353
|
+
},
|
|
354
|
+
traits: [
|
|
355
|
+
{
|
|
356
|
+
name: "CheckoutFlow",
|
|
357
|
+
linkedEntity: "Order",
|
|
358
|
+
category: "interaction",
|
|
359
|
+
stateMachine: {
|
|
360
|
+
states: [
|
|
361
|
+
{ name: "shipping", isInitial: true },
|
|
362
|
+
{ name: "payment" },
|
|
363
|
+
{ name: "review" },
|
|
364
|
+
{ name: "confirmed" }
|
|
365
|
+
],
|
|
366
|
+
events: [
|
|
367
|
+
{ key: "INIT", name: "Initialize" },
|
|
368
|
+
{ key: "SET_SHIPPING", name: "Set Shipping", payloadSchema: [
|
|
369
|
+
{ name: "shippingAddress", type: "string", required: true }
|
|
370
|
+
] },
|
|
371
|
+
{ key: "SET_PAYMENT", name: "Set Payment", payloadSchema: [
|
|
372
|
+
{ name: "paymentMethod", type: "string", required: true }
|
|
373
|
+
] },
|
|
374
|
+
{ key: "CONFIRM", name: "Confirm Order" },
|
|
375
|
+
{ key: "BACK_TO_SHIPPING", name: "Back to Shipping" },
|
|
376
|
+
{ key: "BACK_TO_PAYMENT", name: "Back to Payment" },
|
|
377
|
+
{ key: "NEW_ORDER", name: "New Order" }
|
|
378
|
+
],
|
|
379
|
+
transitions: [
|
|
380
|
+
{
|
|
381
|
+
from: "shipping",
|
|
382
|
+
to: "shipping",
|
|
383
|
+
event: "INIT",
|
|
384
|
+
effects: [
|
|
385
|
+
["fetch", "Order"],
|
|
386
|
+
...[checkoutShippingMainEffect]
|
|
387
|
+
]
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
from: "shipping",
|
|
391
|
+
to: "payment",
|
|
392
|
+
event: "SET_SHIPPING",
|
|
393
|
+
effects: [
|
|
394
|
+
["fetch", "Order"],
|
|
395
|
+
["set", "@entity.shippingAddress", "@payload.shippingAddress"],
|
|
396
|
+
...[checkoutPaymentMainEffect]
|
|
397
|
+
]
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
from: "payment",
|
|
401
|
+
to: "review",
|
|
402
|
+
event: "SET_PAYMENT",
|
|
403
|
+
effects: [
|
|
404
|
+
["fetch", "Order"],
|
|
405
|
+
["set", "@entity.paymentMethod", "@payload.paymentMethod"],
|
|
406
|
+
["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
|
|
407
|
+
// Wizard progress
|
|
408
|
+
{ type: "wizard-progress", currentStep: 2, steps: checkoutWizardSteps },
|
|
409
|
+
{ type: "divider" },
|
|
410
|
+
// Step header
|
|
411
|
+
{ type: "stack", direction: "horizontal", gap: "sm", children: [
|
|
412
|
+
{ type: "icon", name: "clipboard-check", size: "md" },
|
|
413
|
+
{ type: "typography", variant: "h3", content: "Review Order" }
|
|
414
|
+
] },
|
|
415
|
+
// Summary fields
|
|
416
|
+
{ type: "stack", direction: "vertical", gap: "sm", children: [
|
|
417
|
+
{ type: "stack", direction: "horizontal", gap: "md", children: [
|
|
418
|
+
{ type: "icon", name: "dollar-sign", size: "sm" },
|
|
419
|
+
{ type: "typography", variant: "label", content: "Total" },
|
|
420
|
+
{ type: "typography", variant: "body", content: "@entity.total" }
|
|
421
|
+
] },
|
|
422
|
+
{ type: "stack", direction: "horizontal", gap: "md", children: [
|
|
423
|
+
{ type: "icon", name: "map-pin", size: "sm" },
|
|
424
|
+
{ type: "typography", variant: "label", content: "Shipping" },
|
|
425
|
+
{ type: "typography", variant: "body", content: "@entity.shippingAddress" }
|
|
426
|
+
] },
|
|
427
|
+
{ type: "stack", direction: "horizontal", gap: "md", children: [
|
|
428
|
+
{ type: "icon", name: "wallet", size: "sm" },
|
|
429
|
+
{ type: "typography", variant: "label", content: "Payment" },
|
|
430
|
+
{ type: "typography", variant: "body", content: "@entity.paymentMethod" }
|
|
431
|
+
] }
|
|
432
|
+
] },
|
|
433
|
+
{ type: "divider" },
|
|
434
|
+
// Actions
|
|
435
|
+
{ type: "stack", direction: "horizontal", gap: "md", justify: "space-between", children: [
|
|
436
|
+
{ type: "button", label: "Back to Payment", icon: "arrow-left", variant: "ghost", action: "BACK_TO_PAYMENT" },
|
|
437
|
+
{ type: "button", label: "Confirm Order", icon: "check", variant: "primary", action: "CONFIRM" }
|
|
438
|
+
] }
|
|
439
|
+
] }]
|
|
440
|
+
]
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
from: "payment",
|
|
444
|
+
to: "shipping",
|
|
445
|
+
event: "BACK_TO_SHIPPING",
|
|
446
|
+
effects: [
|
|
447
|
+
["fetch", "Order"],
|
|
448
|
+
...[checkoutShippingMainEffect]
|
|
449
|
+
]
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
from: "review",
|
|
453
|
+
to: "confirmed",
|
|
454
|
+
event: "CONFIRM",
|
|
455
|
+
effects: [
|
|
456
|
+
["fetch", "Order"],
|
|
457
|
+
["set", "@entity.status", "confirmed"],
|
|
458
|
+
["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", align: "center", children: [
|
|
459
|
+
// Success icon
|
|
460
|
+
{ type: "icon", name: "check-circle", size: "xl" },
|
|
461
|
+
{ type: "typography", variant: "h2", content: "Order Confirmed" },
|
|
462
|
+
{ type: "divider" },
|
|
463
|
+
// Detail fields
|
|
464
|
+
{ type: "stack", direction: "vertical", gap: "sm", children: [
|
|
465
|
+
{ type: "stack", direction: "horizontal", gap: "md", children: [
|
|
466
|
+
{ type: "icon", name: "hash", size: "sm" },
|
|
467
|
+
{ type: "typography", variant: "label", content: "Status" },
|
|
468
|
+
{ type: "badge", content: "@entity.status", variant: "success" }
|
|
469
|
+
] },
|
|
470
|
+
{ type: "stack", direction: "horizontal", gap: "md", children: [
|
|
471
|
+
{ type: "icon", name: "dollar-sign", size: "sm" },
|
|
472
|
+
{ type: "typography", variant: "label", content: "Total" },
|
|
473
|
+
{ type: "typography", variant: "body", content: "@entity.total" }
|
|
474
|
+
] },
|
|
475
|
+
{ type: "stack", direction: "horizontal", gap: "md", children: [
|
|
476
|
+
{ type: "icon", name: "map-pin", size: "sm" },
|
|
477
|
+
{ type: "typography", variant: "label", content: "Shipping" },
|
|
478
|
+
{ type: "typography", variant: "body", content: "@entity.shippingAddress" }
|
|
479
|
+
] },
|
|
480
|
+
{ type: "stack", direction: "horizontal", gap: "md", children: [
|
|
481
|
+
{ type: "icon", name: "wallet", size: "sm" },
|
|
482
|
+
{ type: "typography", variant: "label", content: "Payment" },
|
|
483
|
+
{ type: "typography", variant: "body", content: "@entity.paymentMethod" }
|
|
484
|
+
] }
|
|
485
|
+
] },
|
|
486
|
+
{ type: "divider" },
|
|
487
|
+
{ type: "button", label: "Place New Order", icon: "plus", variant: "primary", action: "NEW_ORDER" }
|
|
488
|
+
] }]
|
|
489
|
+
]
|
|
490
|
+
},
|
|
491
|
+
{
|
|
492
|
+
from: "review",
|
|
493
|
+
to: "payment",
|
|
494
|
+
event: "BACK_TO_PAYMENT",
|
|
495
|
+
effects: [
|
|
496
|
+
["fetch", "Order"],
|
|
497
|
+
...[checkoutPaymentMainEffect]
|
|
498
|
+
]
|
|
499
|
+
},
|
|
500
|
+
{
|
|
501
|
+
from: "confirmed",
|
|
502
|
+
to: "shipping",
|
|
503
|
+
event: "NEW_ORDER",
|
|
504
|
+
effects: [
|
|
505
|
+
["fetch", "Order"],
|
|
506
|
+
...[checkoutShippingMainEffect]
|
|
507
|
+
]
|
|
508
|
+
}
|
|
509
|
+
]
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
],
|
|
513
|
+
pages: [
|
|
514
|
+
{
|
|
515
|
+
name: "CheckoutPage",
|
|
516
|
+
path: "/checkout",
|
|
517
|
+
isInitial: true,
|
|
518
|
+
traits: [{ ref: "CheckoutFlow" }]
|
|
519
|
+
}
|
|
520
|
+
]
|
|
521
|
+
}
|
|
522
|
+
]
|
|
523
|
+
};
|
|
524
|
+
var catalogBrowsingMainEffect = ["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
|
|
525
|
+
// Header: package icon + title
|
|
526
|
+
{ type: "stack", direction: "horizontal", justify: "space-between", children: [
|
|
527
|
+
{ type: "stack", direction: "horizontal", gap: "sm", children: [
|
|
528
|
+
{ type: "icon", name: "package", size: "lg" },
|
|
529
|
+
{ type: "typography", variant: "h2", content: "Product Catalog" }
|
|
530
|
+
] }
|
|
531
|
+
] },
|
|
532
|
+
{ type: "divider" },
|
|
533
|
+
// Search input
|
|
534
|
+
{ type: "search-input", placeholder: "Search products by category...", event: "APPLY_FILTER", icon: "search" },
|
|
535
|
+
// Product grid
|
|
536
|
+
{
|
|
537
|
+
type: "data-grid",
|
|
538
|
+
entity: "Product",
|
|
539
|
+
cols: 3,
|
|
540
|
+
gap: "md",
|
|
541
|
+
fields: [
|
|
542
|
+
{ name: "name", label: "Product", icon: "box", variant: "h4" },
|
|
543
|
+
{ name: "price", label: "Price", icon: "dollar-sign", variant: "body", format: "currency" },
|
|
544
|
+
{ name: "category", label: "Category", icon: "tag", variant: "badge" },
|
|
545
|
+
{ name: "inStock", label: "Availability", icon: "check-circle", variant: "badge" }
|
|
546
|
+
],
|
|
547
|
+
itemActions: [
|
|
548
|
+
{ label: "View", event: "VIEW_PRODUCT", icon: "eye" }
|
|
549
|
+
]
|
|
550
|
+
}
|
|
551
|
+
] }];
|
|
552
|
+
var catalogFilteredMainEffect = ["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
|
|
553
|
+
// Header with clear filter
|
|
554
|
+
{ type: "stack", direction: "horizontal", justify: "space-between", children: [
|
|
555
|
+
{ type: "stack", direction: "horizontal", gap: "sm", children: [
|
|
556
|
+
{ type: "icon", name: "filter", size: "lg" },
|
|
557
|
+
{ type: "typography", variant: "h2", content: "Filtered Results" }
|
|
558
|
+
] },
|
|
559
|
+
{ type: "button", label: "Clear Filter", icon: "x", variant: "ghost", action: "CLEAR_FILTER" }
|
|
560
|
+
] },
|
|
561
|
+
{ type: "divider" },
|
|
562
|
+
{ type: "search-input", placeholder: "Refine search...", event: "APPLY_FILTER", icon: "search" },
|
|
563
|
+
// Product grid
|
|
564
|
+
{
|
|
565
|
+
type: "data-grid",
|
|
566
|
+
entity: "Product",
|
|
567
|
+
cols: 3,
|
|
568
|
+
gap: "md",
|
|
569
|
+
fields: [
|
|
570
|
+
{ name: "name", label: "Product", icon: "box", variant: "h4" },
|
|
571
|
+
{ name: "price", label: "Price", icon: "dollar-sign", variant: "body", format: "currency" },
|
|
572
|
+
{ name: "category", label: "Category", icon: "tag", variant: "badge" },
|
|
573
|
+
{ name: "inStock", label: "Availability", icon: "check-circle", variant: "badge" }
|
|
574
|
+
],
|
|
575
|
+
itemActions: [
|
|
576
|
+
{ label: "View", event: "VIEW_PRODUCT", icon: "eye" }
|
|
577
|
+
]
|
|
578
|
+
}
|
|
579
|
+
] }];
|
|
580
|
+
var catalogDetailModalEffect = ["render-ui", "modal", { type: "stack", direction: "vertical", gap: "md", children: [
|
|
581
|
+
// Product detail header
|
|
582
|
+
{ type: "stack", direction: "horizontal", justify: "space-between", children: [
|
|
583
|
+
{ type: "stack", direction: "horizontal", gap: "sm", children: [
|
|
584
|
+
{ type: "icon", name: "box", size: "md" },
|
|
585
|
+
{ type: "typography", variant: "h3", content: "Product Details" }
|
|
586
|
+
] },
|
|
587
|
+
{ type: "button", label: "Close", icon: "x", variant: "ghost", action: "CLOSE" }
|
|
588
|
+
] },
|
|
589
|
+
{ type: "divider" },
|
|
590
|
+
// Product info in horizontal stacks
|
|
591
|
+
{ type: "stack", direction: "vertical", gap: "sm", children: [
|
|
592
|
+
{ type: "stack", direction: "horizontal", gap: "md", children: [
|
|
593
|
+
{ type: "icon", name: "package", size: "sm" },
|
|
594
|
+
{ type: "typography", variant: "label", content: "Name" },
|
|
595
|
+
{ type: "typography", variant: "body", content: "@entity.name" }
|
|
596
|
+
] },
|
|
597
|
+
{ type: "stack", direction: "horizontal", gap: "md", children: [
|
|
598
|
+
{ type: "icon", name: "file-text", size: "sm" },
|
|
599
|
+
{ type: "typography", variant: "label", content: "Description" },
|
|
600
|
+
{ type: "typography", variant: "body", content: "@entity.description" }
|
|
601
|
+
] },
|
|
602
|
+
{ type: "stack", direction: "horizontal", gap: "md", children: [
|
|
603
|
+
{ type: "icon", name: "dollar-sign", size: "sm" },
|
|
604
|
+
{ type: "typography", variant: "label", content: "Price" },
|
|
605
|
+
{ type: "typography", variant: "body", content: "@entity.price" }
|
|
606
|
+
] },
|
|
607
|
+
{ type: "stack", direction: "horizontal", gap: "md", children: [
|
|
608
|
+
{ type: "icon", name: "tag", size: "sm" },
|
|
609
|
+
{ type: "typography", variant: "label", content: "Category" },
|
|
610
|
+
{ type: "badge", content: "@entity.category" }
|
|
611
|
+
] },
|
|
612
|
+
{ type: "stack", direction: "horizontal", gap: "md", children: [
|
|
613
|
+
{ type: "icon", name: "check-circle", size: "sm" },
|
|
614
|
+
{ type: "typography", variant: "label", content: "In Stock" },
|
|
615
|
+
{ type: "badge", content: "@entity.inStock", variant: "success" }
|
|
616
|
+
] }
|
|
617
|
+
] }
|
|
618
|
+
] }];
|
|
619
|
+
var CATALOG_BEHAVIOR = {
|
|
620
|
+
name: "std-catalog",
|
|
621
|
+
version: "1.0.0",
|
|
622
|
+
description: "Product catalog with browsing, filtering, and detail view",
|
|
623
|
+
theme: COMMERCE_THEME,
|
|
624
|
+
orbitals: [
|
|
625
|
+
{
|
|
626
|
+
name: "CatalogOrbital",
|
|
627
|
+
entity: {
|
|
628
|
+
name: "Product",
|
|
629
|
+
persistence: "persistent",
|
|
630
|
+
collection: "products",
|
|
631
|
+
fields: [
|
|
632
|
+
{ name: "id", type: "string", required: true },
|
|
633
|
+
{ name: "name", type: "string", default: "" },
|
|
634
|
+
{ name: "description", type: "string", default: "" },
|
|
635
|
+
{ name: "price", type: "number", default: 0 },
|
|
636
|
+
{ name: "category", type: "string", default: "" },
|
|
637
|
+
{ name: "inStock", type: "boolean", default: true }
|
|
638
|
+
]
|
|
639
|
+
},
|
|
640
|
+
traits: [
|
|
641
|
+
{
|
|
642
|
+
name: "CatalogBrowse",
|
|
643
|
+
linkedEntity: "Product",
|
|
644
|
+
category: "interaction",
|
|
645
|
+
stateMachine: {
|
|
646
|
+
states: [
|
|
647
|
+
{ name: "browsing", isInitial: true },
|
|
648
|
+
{ name: "viewing" },
|
|
649
|
+
{ name: "filtering" }
|
|
650
|
+
],
|
|
651
|
+
events: [
|
|
652
|
+
{ key: "INIT", name: "Initialize" },
|
|
653
|
+
{ key: "VIEW_PRODUCT", name: "View Product", payloadSchema: [
|
|
654
|
+
{ name: "id", type: "string", required: true }
|
|
655
|
+
] },
|
|
656
|
+
{ key: "CLOSE", name: "Close" },
|
|
657
|
+
{ key: "CANCEL", name: "Cancel" },
|
|
658
|
+
{ key: "APPLY_FILTER", name: "Apply Filter", payloadSchema: [
|
|
659
|
+
{ name: "category", type: "string", required: true }
|
|
660
|
+
] },
|
|
661
|
+
{ key: "CLEAR_FILTER", name: "Clear Filter" }
|
|
662
|
+
],
|
|
663
|
+
transitions: [
|
|
664
|
+
{
|
|
665
|
+
from: "browsing",
|
|
666
|
+
to: "browsing",
|
|
667
|
+
event: "INIT",
|
|
668
|
+
effects: [
|
|
669
|
+
["fetch", "Product"],
|
|
670
|
+
...[catalogBrowsingMainEffect]
|
|
671
|
+
]
|
|
672
|
+
},
|
|
673
|
+
{
|
|
674
|
+
from: "browsing",
|
|
675
|
+
to: "viewing",
|
|
676
|
+
event: "VIEW_PRODUCT",
|
|
677
|
+
effects: [
|
|
678
|
+
["fetch", "Product"],
|
|
679
|
+
...[catalogDetailModalEffect]
|
|
680
|
+
]
|
|
681
|
+
},
|
|
682
|
+
{ from: "viewing", to: "browsing", event: "CLOSE", effects: [["render-ui", "modal", null]] },
|
|
683
|
+
{ from: "viewing", to: "browsing", event: "CANCEL", effects: [["render-ui", "modal", null]] },
|
|
684
|
+
{
|
|
685
|
+
from: "browsing",
|
|
686
|
+
to: "filtering",
|
|
687
|
+
event: "APPLY_FILTER",
|
|
688
|
+
effects: [
|
|
689
|
+
["fetch", "Product"],
|
|
690
|
+
["set", "@entity.category", "@payload.category"],
|
|
691
|
+
...[catalogFilteredMainEffect]
|
|
692
|
+
]
|
|
693
|
+
},
|
|
694
|
+
{
|
|
695
|
+
from: "filtering",
|
|
696
|
+
to: "filtering",
|
|
697
|
+
event: "APPLY_FILTER",
|
|
698
|
+
effects: [
|
|
699
|
+
["fetch", "Product"],
|
|
700
|
+
["set", "@entity.category", "@payload.category"],
|
|
701
|
+
...[catalogFilteredMainEffect]
|
|
702
|
+
]
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
from: "filtering",
|
|
706
|
+
to: "viewing",
|
|
707
|
+
event: "VIEW_PRODUCT",
|
|
708
|
+
effects: [
|
|
709
|
+
["fetch", "Product"],
|
|
710
|
+
...[catalogDetailModalEffect]
|
|
711
|
+
]
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
from: "filtering",
|
|
715
|
+
to: "browsing",
|
|
716
|
+
event: "CLEAR_FILTER",
|
|
717
|
+
effects: [
|
|
718
|
+
["set", "@entity.category", ""],
|
|
719
|
+
["fetch", "Product"],
|
|
720
|
+
...[catalogBrowsingMainEffect]
|
|
721
|
+
]
|
|
722
|
+
}
|
|
723
|
+
]
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
],
|
|
727
|
+
pages: [
|
|
728
|
+
{
|
|
729
|
+
name: "CatalogPage",
|
|
730
|
+
path: "/catalog",
|
|
731
|
+
isInitial: true,
|
|
732
|
+
traits: [{ ref: "CatalogBrowse" }]
|
|
733
|
+
}
|
|
734
|
+
]
|
|
735
|
+
}
|
|
736
|
+
]
|
|
737
|
+
};
|
|
738
|
+
var pricingBrowsingMainEffect = ["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
|
|
739
|
+
// Header: tag icon + title
|
|
740
|
+
{ type: "stack", direction: "horizontal", justify: "space-between", children: [
|
|
741
|
+
{ type: "stack", direction: "horizontal", gap: "sm", children: [
|
|
742
|
+
{ type: "icon", name: "tag", size: "lg" },
|
|
743
|
+
{ type: "typography", variant: "h2", content: "Price Rules" }
|
|
744
|
+
] }
|
|
745
|
+
] },
|
|
746
|
+
{ type: "divider" },
|
|
747
|
+
// Stats
|
|
748
|
+
{ type: "stack", direction: "horizontal", gap: "md", children: [
|
|
749
|
+
{ type: "stats", label: "Total Rules", icon: "layers", entity: "PriceRule" },
|
|
750
|
+
{ type: "line-chart", entity: "PriceRule" }
|
|
751
|
+
] },
|
|
752
|
+
{ type: "divider" },
|
|
753
|
+
// Rules list
|
|
754
|
+
{
|
|
755
|
+
type: "data-list",
|
|
756
|
+
entity: "PriceRule",
|
|
757
|
+
variant: "card",
|
|
758
|
+
fields: [
|
|
759
|
+
{ name: "name", label: "Rule Name", icon: "bookmark", variant: "h4" },
|
|
760
|
+
{ name: "type", label: "Type", icon: "sliders", variant: "badge" },
|
|
761
|
+
{ name: "value", label: "Value", icon: "dollar-sign", variant: "body", format: "currency" },
|
|
762
|
+
{ name: "startDate", label: "Start", icon: "calendar", variant: "caption", format: "date" },
|
|
763
|
+
{ name: "endDate", label: "End", icon: "calendar", variant: "caption", format: "date" }
|
|
764
|
+
],
|
|
765
|
+
itemActions: [
|
|
766
|
+
{ label: "Edit", event: "EDIT_RULE", icon: "pencil" },
|
|
767
|
+
{ label: "Preview", event: "PREVIEW_RULE", icon: "eye" }
|
|
768
|
+
]
|
|
769
|
+
}
|
|
770
|
+
] }];
|
|
771
|
+
var PRICING_BEHAVIOR = {
|
|
772
|
+
name: "std-pricing",
|
|
773
|
+
version: "1.0.0",
|
|
774
|
+
description: "Price rule management with CRUD and preview",
|
|
775
|
+
theme: COMMERCE_THEME,
|
|
776
|
+
orbitals: [
|
|
777
|
+
{
|
|
778
|
+
name: "PricingOrbital",
|
|
779
|
+
entity: {
|
|
780
|
+
name: "PriceRule",
|
|
781
|
+
persistence: "persistent",
|
|
782
|
+
collection: "price_rules",
|
|
783
|
+
fields: [
|
|
784
|
+
{ name: "id", type: "string", required: true },
|
|
785
|
+
{ name: "name", type: "string", default: "" },
|
|
786
|
+
{ name: "type", type: "string", default: "percentage" },
|
|
787
|
+
{ name: "value", type: "number", default: 0 },
|
|
788
|
+
{ name: "startDate", type: "string", default: "" },
|
|
789
|
+
{ name: "endDate", type: "string", default: "" }
|
|
790
|
+
]
|
|
791
|
+
},
|
|
792
|
+
traits: [
|
|
793
|
+
{
|
|
794
|
+
name: "PricingManagement",
|
|
795
|
+
linkedEntity: "PriceRule",
|
|
796
|
+
category: "interaction",
|
|
797
|
+
stateMachine: {
|
|
798
|
+
states: [
|
|
799
|
+
{ name: "browsing", isInitial: true },
|
|
800
|
+
{ name: "editing" },
|
|
801
|
+
{ name: "previewing" }
|
|
802
|
+
],
|
|
803
|
+
events: [
|
|
804
|
+
{ key: "INIT", name: "Initialize" },
|
|
805
|
+
{ key: "EDIT_RULE", name: "Edit Rule", payloadSchema: [
|
|
806
|
+
{ name: "id", type: "string", required: true }
|
|
807
|
+
] },
|
|
808
|
+
{ key: "SAVE_RULE", name: "Save Rule", payloadSchema: [
|
|
809
|
+
{ name: "name", type: "string", required: true },
|
|
810
|
+
{ name: "value", type: "number", required: true }
|
|
811
|
+
] },
|
|
812
|
+
{ key: "PREVIEW_RULE", name: "Preview Rule" },
|
|
813
|
+
{ key: "CLOSE", name: "Close" },
|
|
814
|
+
{ key: "CANCEL", name: "Cancel" },
|
|
815
|
+
{ key: "BACK_TO_LIST", name: "Back to List" }
|
|
816
|
+
],
|
|
817
|
+
transitions: [
|
|
818
|
+
{
|
|
819
|
+
from: "browsing",
|
|
820
|
+
to: "browsing",
|
|
821
|
+
event: "INIT",
|
|
822
|
+
effects: [
|
|
823
|
+
["fetch", "PriceRule"],
|
|
824
|
+
...[pricingBrowsingMainEffect]
|
|
825
|
+
]
|
|
826
|
+
},
|
|
827
|
+
{
|
|
828
|
+
from: "browsing",
|
|
829
|
+
to: "editing",
|
|
830
|
+
event: "EDIT_RULE",
|
|
831
|
+
effects: [
|
|
832
|
+
["fetch", "PriceRule"],
|
|
833
|
+
["render-ui", "modal", { type: "stack", direction: "vertical", gap: "md", children: [
|
|
834
|
+
// Modal header
|
|
835
|
+
{ type: "stack", direction: "horizontal", gap: "sm", children: [
|
|
836
|
+
{ type: "icon", name: "pencil", size: "md" },
|
|
837
|
+
{ type: "typography", variant: "h3", content: "Edit Price Rule" }
|
|
838
|
+
] },
|
|
839
|
+
{ type: "divider" },
|
|
840
|
+
// Edit form
|
|
841
|
+
{
|
|
842
|
+
type: "form-section",
|
|
843
|
+
entity: "PriceRule",
|
|
844
|
+
submitEvent: "SAVE_RULE",
|
|
845
|
+
cancelEvent: "CANCEL",
|
|
846
|
+
fields: [
|
|
847
|
+
{ name: "name", label: "Rule Name", icon: "bookmark" },
|
|
848
|
+
{ name: "value", label: "Value", icon: "dollar-sign" }
|
|
849
|
+
]
|
|
850
|
+
}
|
|
851
|
+
] }]
|
|
852
|
+
]
|
|
853
|
+
},
|
|
854
|
+
{
|
|
855
|
+
from: "editing",
|
|
856
|
+
to: "browsing",
|
|
857
|
+
event: "SAVE_RULE",
|
|
858
|
+
effects: [
|
|
859
|
+
["fetch", "PriceRule"],
|
|
860
|
+
["set", "@entity.name", "@payload.name"],
|
|
861
|
+
["set", "@entity.value", "@payload.value"],
|
|
862
|
+
["render-ui", "modal", null],
|
|
863
|
+
...[pricingBrowsingMainEffect]
|
|
864
|
+
]
|
|
865
|
+
},
|
|
866
|
+
{ from: "editing", to: "browsing", event: "CLOSE", effects: [["render-ui", "modal", null]] },
|
|
867
|
+
{ from: "editing", to: "browsing", event: "CANCEL", effects: [["render-ui", "modal", null]] },
|
|
868
|
+
{
|
|
869
|
+
from: "browsing",
|
|
870
|
+
to: "previewing",
|
|
871
|
+
event: "PREVIEW_RULE",
|
|
872
|
+
effects: [
|
|
873
|
+
["fetch", "PriceRule"],
|
|
874
|
+
["render-ui", "modal", { type: "stack", direction: "vertical", gap: "md", children: [
|
|
875
|
+
// Preview header
|
|
876
|
+
{ type: "stack", direction: "horizontal", justify: "space-between", children: [
|
|
877
|
+
{ type: "stack", direction: "horizontal", gap: "sm", children: [
|
|
878
|
+
{ type: "icon", name: "eye", size: "md" },
|
|
879
|
+
{ type: "typography", variant: "h3", content: "Rule Preview" }
|
|
880
|
+
] },
|
|
881
|
+
{ type: "button", label: "Close", icon: "x", variant: "ghost", action: "CLOSE" }
|
|
882
|
+
] },
|
|
883
|
+
{ type: "divider" },
|
|
884
|
+
// Rule details in stacks
|
|
885
|
+
{ type: "stack", direction: "vertical", gap: "sm", children: [
|
|
886
|
+
{ type: "stack", direction: "horizontal", gap: "md", children: [
|
|
887
|
+
{ type: "icon", name: "bookmark", size: "sm" },
|
|
888
|
+
{ type: "typography", variant: "label", content: "Name" },
|
|
889
|
+
{ type: "typography", variant: "body", content: "@entity.name" }
|
|
890
|
+
] },
|
|
891
|
+
{ type: "stack", direction: "horizontal", gap: "md", children: [
|
|
892
|
+
{ type: "icon", name: "sliders", size: "sm" },
|
|
893
|
+
{ type: "typography", variant: "label", content: "Type" },
|
|
894
|
+
{ type: "badge", content: "@entity.type" }
|
|
895
|
+
] },
|
|
896
|
+
{ type: "stack", direction: "horizontal", gap: "md", children: [
|
|
897
|
+
{ type: "icon", name: "dollar-sign", size: "sm" },
|
|
898
|
+
{ type: "typography", variant: "label", content: "Value" },
|
|
899
|
+
{ type: "typography", variant: "body", content: "@entity.value" }
|
|
900
|
+
] },
|
|
901
|
+
{ type: "stack", direction: "horizontal", gap: "md", children: [
|
|
902
|
+
{ type: "icon", name: "calendar", size: "sm" },
|
|
903
|
+
{ type: "typography", variant: "label", content: "Start Date" },
|
|
904
|
+
{ type: "typography", variant: "body", content: "@entity.startDate" }
|
|
905
|
+
] },
|
|
906
|
+
{ type: "stack", direction: "horizontal", gap: "md", children: [
|
|
907
|
+
{ type: "icon", name: "calendar", size: "sm" },
|
|
908
|
+
{ type: "typography", variant: "label", content: "End Date" },
|
|
909
|
+
{ type: "typography", variant: "body", content: "@entity.endDate" }
|
|
910
|
+
] }
|
|
911
|
+
] }
|
|
912
|
+
] }]
|
|
913
|
+
]
|
|
914
|
+
},
|
|
915
|
+
{ from: "previewing", to: "browsing", event: "CLOSE", effects: [["render-ui", "modal", null]] },
|
|
916
|
+
{ from: "previewing", to: "browsing", event: "CANCEL", effects: [["render-ui", "modal", null]] },
|
|
917
|
+
{
|
|
918
|
+
from: "previewing",
|
|
919
|
+
to: "browsing",
|
|
920
|
+
event: "BACK_TO_LIST",
|
|
921
|
+
effects: [
|
|
922
|
+
["fetch", "PriceRule"],
|
|
923
|
+
["render-ui", "modal", null],
|
|
924
|
+
...[pricingBrowsingMainEffect]
|
|
925
|
+
]
|
|
926
|
+
}
|
|
927
|
+
]
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
],
|
|
931
|
+
pages: [
|
|
932
|
+
{
|
|
933
|
+
name: "PricingPage",
|
|
934
|
+
path: "/pricing",
|
|
935
|
+
isInitial: true,
|
|
936
|
+
traits: [{ ref: "PricingManagement" }]
|
|
937
|
+
}
|
|
938
|
+
]
|
|
939
|
+
}
|
|
940
|
+
]
|
|
941
|
+
};
|
|
942
|
+
var orderTrackingBrowsingMainEffect = ["render-ui", "main", { type: "stack", direction: "vertical", gap: "lg", children: [
|
|
943
|
+
// Header: truck icon + title
|
|
944
|
+
{ type: "stack", direction: "horizontal", gap: "sm", children: [
|
|
945
|
+
{ type: "icon", name: "truck", size: "lg" },
|
|
946
|
+
{ type: "typography", variant: "h2", content: "Order Tracking" }
|
|
947
|
+
] },
|
|
948
|
+
{ type: "divider" },
|
|
949
|
+
// Stats
|
|
950
|
+
{ type: "stack", direction: "horizontal", gap: "md", children: [
|
|
951
|
+
{ type: "stats", label: "Total Orders", icon: "clipboard-list", entity: "OrderStatus" },
|
|
952
|
+
{ type: "stats", label: "Status", icon: "activity", value: "@entity.status" }
|
|
953
|
+
] },
|
|
954
|
+
{ type: "divider" },
|
|
955
|
+
// Search
|
|
956
|
+
{ type: "search-input", placeholder: "Search by order ID or tracking number...", entity: "OrderStatus", icon: "search" },
|
|
957
|
+
// Order list with status badges and tracking info
|
|
958
|
+
{
|
|
959
|
+
type: "data-list",
|
|
960
|
+
entity: "OrderStatus",
|
|
961
|
+
variant: "card",
|
|
962
|
+
fields: [
|
|
963
|
+
{ name: "orderId", label: "Order ID", icon: "hash", variant: "h4" },
|
|
964
|
+
{ name: "status", label: "Status", icon: "loader", variant: "badge" },
|
|
965
|
+
{ name: "trackingNumber", label: "Tracking #", icon: "map-pin", variant: "body" },
|
|
966
|
+
{ name: "estimatedDelivery", label: "Est. Delivery", icon: "calendar", variant: "caption", format: "date" }
|
|
967
|
+
],
|
|
968
|
+
itemActions: [
|
|
969
|
+
{ label: "View", event: "VIEW_ORDER", icon: "eye" }
|
|
970
|
+
]
|
|
971
|
+
}
|
|
972
|
+
] }];
|
|
973
|
+
var ORDER_TRACKING_BEHAVIOR = {
|
|
974
|
+
name: "std-order-tracking",
|
|
975
|
+
version: "1.0.0",
|
|
976
|
+
description: "Order tracking with status and delivery estimates",
|
|
977
|
+
theme: COMMERCE_THEME,
|
|
978
|
+
orbitals: [
|
|
979
|
+
{
|
|
980
|
+
name: "OrderTrackingOrbital",
|
|
981
|
+
entity: {
|
|
982
|
+
name: "OrderStatus",
|
|
983
|
+
persistence: "persistent",
|
|
984
|
+
collection: "order_statuses",
|
|
985
|
+
fields: [
|
|
986
|
+
{ name: "id", type: "string", required: true },
|
|
987
|
+
{ name: "orderId", type: "string", default: "" },
|
|
988
|
+
{ name: "status", type: "string", default: "pending" },
|
|
989
|
+
{ name: "estimatedDelivery", type: "string", default: "" },
|
|
990
|
+
{ name: "trackingNumber", type: "string", default: "" }
|
|
991
|
+
]
|
|
992
|
+
},
|
|
993
|
+
traits: [
|
|
994
|
+
{
|
|
995
|
+
name: "OrderTrackingView",
|
|
996
|
+
linkedEntity: "OrderStatus",
|
|
997
|
+
category: "interaction",
|
|
998
|
+
stateMachine: {
|
|
999
|
+
states: [
|
|
1000
|
+
{ name: "browsing", isInitial: true },
|
|
1001
|
+
{ name: "viewing" }
|
|
1002
|
+
],
|
|
1003
|
+
events: [
|
|
1004
|
+
{ key: "INIT", name: "Initialize" },
|
|
1005
|
+
{ key: "VIEW_ORDER", name: "View Order", payloadSchema: [
|
|
1006
|
+
{ name: "id", type: "string", required: true }
|
|
1007
|
+
] },
|
|
1008
|
+
{ key: "CLOSE", name: "Close" },
|
|
1009
|
+
{ key: "CANCEL", name: "Cancel" }
|
|
1010
|
+
],
|
|
1011
|
+
transitions: [
|
|
1012
|
+
{
|
|
1013
|
+
from: "browsing",
|
|
1014
|
+
to: "browsing",
|
|
1015
|
+
event: "INIT",
|
|
1016
|
+
effects: [
|
|
1017
|
+
["fetch", "OrderStatus"],
|
|
1018
|
+
...[orderTrackingBrowsingMainEffect]
|
|
1019
|
+
]
|
|
1020
|
+
},
|
|
1021
|
+
{
|
|
1022
|
+
from: "browsing",
|
|
1023
|
+
to: "viewing",
|
|
1024
|
+
event: "VIEW_ORDER",
|
|
1025
|
+
effects: [
|
|
1026
|
+
["fetch", "OrderStatus"],
|
|
1027
|
+
["render-ui", "modal", { type: "stack", direction: "vertical", gap: "md", children: [
|
|
1028
|
+
// Modal header
|
|
1029
|
+
{ type: "stack", direction: "horizontal", justify: "space-between", children: [
|
|
1030
|
+
{ type: "stack", direction: "horizontal", gap: "sm", children: [
|
|
1031
|
+
{ type: "icon", name: "truck", size: "md" },
|
|
1032
|
+
{ type: "typography", variant: "h3", content: "Order Details" }
|
|
1033
|
+
] },
|
|
1034
|
+
{ type: "button", label: "Close", icon: "x", variant: "ghost", action: "CLOSE" }
|
|
1035
|
+
] },
|
|
1036
|
+
{ type: "divider" },
|
|
1037
|
+
// Progress indicator for order status
|
|
1038
|
+
{ type: "meter", value: "@entity.status", label: "Order Progress", icon: "loader" },
|
|
1039
|
+
{ type: "divider" },
|
|
1040
|
+
// Order detail fields
|
|
1041
|
+
{ type: "stack", direction: "vertical", gap: "sm", children: [
|
|
1042
|
+
{ type: "stack", direction: "horizontal", gap: "md", children: [
|
|
1043
|
+
{ type: "icon", name: "hash", size: "sm" },
|
|
1044
|
+
{ type: "typography", variant: "label", content: "Order ID" },
|
|
1045
|
+
{ type: "typography", variant: "body", content: "@entity.orderId" }
|
|
1046
|
+
] },
|
|
1047
|
+
{ type: "stack", direction: "horizontal", gap: "md", children: [
|
|
1048
|
+
{ type: "icon", name: "activity", size: "sm" },
|
|
1049
|
+
{ type: "typography", variant: "label", content: "Status" },
|
|
1050
|
+
{ type: "badge", content: "@entity.status" }
|
|
1051
|
+
] },
|
|
1052
|
+
{ type: "stack", direction: "horizontal", gap: "md", children: [
|
|
1053
|
+
{ type: "icon", name: "map-pin", size: "sm" },
|
|
1054
|
+
{ type: "typography", variant: "label", content: "Tracking Number" },
|
|
1055
|
+
{ type: "typography", variant: "body", content: "@entity.trackingNumber" }
|
|
1056
|
+
] },
|
|
1057
|
+
{ type: "stack", direction: "horizontal", gap: "md", children: [
|
|
1058
|
+
{ type: "icon", name: "calendar", size: "sm" },
|
|
1059
|
+
{ type: "typography", variant: "label", content: "Estimated Delivery" },
|
|
1060
|
+
{ type: "typography", variant: "body", content: "@entity.estimatedDelivery" }
|
|
1061
|
+
] }
|
|
1062
|
+
] }
|
|
1063
|
+
] }]
|
|
1064
|
+
]
|
|
1065
|
+
},
|
|
1066
|
+
{ from: "viewing", to: "browsing", event: "CLOSE", effects: [["render-ui", "modal", null]] },
|
|
1067
|
+
{ from: "viewing", to: "browsing", event: "CANCEL", effects: [["render-ui", "modal", null]] }
|
|
1068
|
+
]
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
],
|
|
1072
|
+
pages: [
|
|
1073
|
+
{
|
|
1074
|
+
name: "OrderTrackingPage",
|
|
1075
|
+
path: "/order-tracking",
|
|
1076
|
+
isInitial: true,
|
|
1077
|
+
traits: [{ ref: "OrderTrackingView" }]
|
|
1078
|
+
}
|
|
1079
|
+
]
|
|
1080
|
+
}
|
|
1081
|
+
]
|
|
1082
|
+
};
|
|
1083
|
+
var COMMERCE_BEHAVIORS = [
|
|
1084
|
+
CART_BEHAVIOR,
|
|
1085
|
+
CHECKOUT_BEHAVIOR,
|
|
1086
|
+
CATALOG_BEHAVIOR,
|
|
1087
|
+
PRICING_BEHAVIOR,
|
|
1088
|
+
ORDER_TRACKING_BEHAVIOR
|
|
1089
|
+
];
|
|
1090
|
+
|
|
1091
|
+
export { CART_BEHAVIOR, CATALOG_BEHAVIOR, CHECKOUT_BEHAVIOR, COMMERCE_BEHAVIORS, ORDER_TRACKING_BEHAVIOR, PRICING_BEHAVIOR };
|
|
1092
|
+
//# sourceMappingURL=commerce.js.map
|
|
1093
|
+
//# sourceMappingURL=commerce.js.map
|