@almadar/std 3.2.3 → 3.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/LICENSE +72 -21
  2. package/README.md +1 -1
  3. package/behaviors/exports/atoms/std-combat-log.orb +12 -12
  4. package/behaviors/exports/atoms/std-dialogue-box.orb +11 -11
  5. package/behaviors/exports/atoms/std-game-audio.orb +9 -9
  6. package/behaviors/exports/atoms/std-game-canvas3d.orb +24 -24
  7. package/behaviors/exports/atoms/std-game-hud.orb +10 -10
  8. package/behaviors/exports/atoms/std-game-menu.orb +12 -12
  9. package/behaviors/exports/atoms/std-game-over-screen.orb +9 -9
  10. package/behaviors/exports/atoms/std-inventory-panel.orb +13 -13
  11. package/behaviors/exports/atoms/std-isometric-canvas.orb +9 -9
  12. package/behaviors/exports/atoms/std-platformer-canvas.orb +9 -9
  13. package/behaviors/exports/atoms/std-score-board.orb +9 -9
  14. package/behaviors/exports/atoms/std-selection.orb +32 -18
  15. package/behaviors/exports/atoms/std-service-custom-bearer.orb +557 -0
  16. package/behaviors/exports/atoms/std-service-custom-header.orb +559 -0
  17. package/behaviors/exports/atoms/std-service-custom-noauth.orb +553 -0
  18. package/behaviors/exports/atoms/std-service-custom-query.orb +559 -0
  19. package/behaviors/exports/atoms/std-service-email.orb +540 -0
  20. package/behaviors/exports/atoms/std-service-github.orb +586 -0
  21. package/behaviors/exports/atoms/std-service-llm.orb +671 -0
  22. package/behaviors/exports/atoms/std-service-oauth.orb +764 -0
  23. package/behaviors/exports/atoms/std-service-redis.orb +580 -0
  24. package/behaviors/exports/atoms/std-service-storage.orb +664 -0
  25. package/behaviors/exports/atoms/std-service-stripe.orb +639 -0
  26. package/behaviors/exports/atoms/std-service-twilio.orb +611 -0
  27. package/behaviors/exports/atoms/std-service-youtube.orb +696 -0
  28. package/behaviors/exports/atoms/std-simulation-canvas.orb +9 -9
  29. package/behaviors/exports/atoms/std-sprite.orb +17 -17
  30. package/behaviors/exports/atoms/std-validate-on-save.orb +623 -0
  31. package/behaviors/exports/molecules/std-quiz.orb +48 -24
  32. package/behaviors/exports/molecules/std-service-content-pipeline.orb +915 -0
  33. package/behaviors/exports/molecules/std-service-custom-api-tester.orb +860 -0
  34. package/behaviors/exports/molecules/std-service-devops-toolkit.orb +1526 -0
  35. package/behaviors/exports/molecules/std-service-notification-hub.orb +696 -0
  36. package/behaviors/exports/molecules/std-service-payment-flow.orb +873 -0
  37. package/behaviors/exports/organisms/std-service-marketplace.orb +5191 -0
  38. package/behaviors/exports/organisms/std-service-research-assistant.orb +3568 -0
  39. package/behaviors/exports/test-schemas/os-trigger-simulation.orb +202 -0
  40. package/behaviors/exports/validation-report.json +2 -2
  41. package/dist/behaviors/exports/atoms/std-combat-log.orb +12 -12
  42. package/dist/behaviors/exports/atoms/std-dialogue-box.orb +11 -11
  43. package/dist/behaviors/exports/atoms/std-game-audio.orb +9 -9
  44. package/dist/behaviors/exports/atoms/std-game-canvas3d.orb +24 -24
  45. package/dist/behaviors/exports/atoms/std-game-hud.orb +10 -10
  46. package/dist/behaviors/exports/atoms/std-game-menu.orb +12 -12
  47. package/dist/behaviors/exports/atoms/std-game-over-screen.orb +9 -9
  48. package/dist/behaviors/exports/atoms/std-inventory-panel.orb +13 -13
  49. package/dist/behaviors/exports/atoms/std-isometric-canvas.orb +9 -9
  50. package/dist/behaviors/exports/atoms/std-platformer-canvas.orb +9 -9
  51. package/dist/behaviors/exports/atoms/std-score-board.orb +9 -9
  52. package/dist/behaviors/exports/atoms/std-selection.orb +32 -18
  53. package/dist/behaviors/exports/atoms/std-service-custom-bearer.orb +557 -0
  54. package/dist/behaviors/exports/atoms/std-service-custom-header.orb +559 -0
  55. package/dist/behaviors/exports/atoms/std-service-custom-noauth.orb +553 -0
  56. package/dist/behaviors/exports/atoms/std-service-custom-query.orb +559 -0
  57. package/dist/behaviors/exports/atoms/std-service-email.orb +540 -0
  58. package/dist/behaviors/exports/atoms/std-service-github.orb +586 -0
  59. package/dist/behaviors/exports/atoms/std-service-llm.orb +671 -0
  60. package/dist/behaviors/exports/atoms/std-service-oauth.orb +764 -0
  61. package/dist/behaviors/exports/atoms/std-service-redis.orb +580 -0
  62. package/dist/behaviors/exports/atoms/std-service-storage.orb +664 -0
  63. package/dist/behaviors/exports/atoms/std-service-stripe.orb +639 -0
  64. package/dist/behaviors/exports/atoms/std-service-twilio.orb +611 -0
  65. package/dist/behaviors/exports/atoms/std-service-youtube.orb +696 -0
  66. package/dist/behaviors/exports/atoms/std-simulation-canvas.orb +9 -9
  67. package/dist/behaviors/exports/atoms/std-sprite.orb +17 -17
  68. package/dist/behaviors/exports/atoms/std-validate-on-save.orb +623 -0
  69. package/dist/behaviors/exports/molecules/std-quiz.orb +48 -24
  70. package/dist/behaviors/exports/molecules/std-service-content-pipeline.orb +915 -0
  71. package/dist/behaviors/exports/molecules/std-service-custom-api-tester.orb +860 -0
  72. package/dist/behaviors/exports/molecules/std-service-devops-toolkit.orb +1526 -0
  73. package/dist/behaviors/exports/molecules/std-service-notification-hub.orb +696 -0
  74. package/dist/behaviors/exports/molecules/std-service-payment-flow.orb +873 -0
  75. package/dist/behaviors/exports/organisms/std-service-marketplace.orb +5191 -0
  76. package/dist/behaviors/exports/organisms/std-service-research-assistant.orb +3568 -0
  77. package/dist/behaviors/exports/test-schemas/os-trigger-simulation.orb +202 -0
  78. package/dist/behaviors/exports/validation-report.json +2 -2
  79. package/dist/behaviors/functions/index.d.ts +662 -1
  80. package/dist/behaviors/functions/index.js +7638 -2117
  81. package/dist/behaviors/functions/index.js.map +1 -1
  82. package/dist/behaviors/index.d.ts +1 -1
  83. package/dist/behaviors/index.js +7638 -2117
  84. package/dist/behaviors/index.js.map +1 -1
  85. package/dist/exports/atoms/std-combat-log.orb +12 -12
  86. package/dist/exports/atoms/std-dialogue-box.orb +11 -11
  87. package/dist/exports/atoms/std-game-audio.orb +9 -9
  88. package/dist/exports/atoms/std-game-canvas3d.orb +24 -24
  89. package/dist/exports/atoms/std-game-hud.orb +10 -10
  90. package/dist/exports/atoms/std-game-menu.orb +12 -12
  91. package/dist/exports/atoms/std-game-over-screen.orb +9 -9
  92. package/dist/exports/atoms/std-inventory-panel.orb +13 -13
  93. package/dist/exports/atoms/std-isometric-canvas.orb +9 -9
  94. package/dist/exports/atoms/std-platformer-canvas.orb +9 -9
  95. package/dist/exports/atoms/std-score-board.orb +9 -9
  96. package/dist/exports/atoms/std-selection.orb +32 -18
  97. package/dist/exports/atoms/std-service-custom-bearer.orb +557 -0
  98. package/dist/exports/atoms/std-service-custom-header.orb +559 -0
  99. package/dist/exports/atoms/std-service-custom-noauth.orb +553 -0
  100. package/dist/exports/atoms/std-service-custom-query.orb +559 -0
  101. package/dist/exports/atoms/std-service-email.orb +540 -0
  102. package/dist/exports/atoms/std-service-github.orb +586 -0
  103. package/dist/exports/atoms/std-service-llm.orb +671 -0
  104. package/dist/exports/atoms/std-service-oauth.orb +764 -0
  105. package/dist/exports/atoms/std-service-redis.orb +580 -0
  106. package/dist/exports/atoms/std-service-storage.orb +664 -0
  107. package/dist/exports/atoms/std-service-stripe.orb +639 -0
  108. package/dist/exports/atoms/std-service-twilio.orb +611 -0
  109. package/dist/exports/atoms/std-service-youtube.orb +696 -0
  110. package/dist/exports/atoms/std-simulation-canvas.orb +9 -9
  111. package/dist/exports/atoms/std-sprite.orb +17 -17
  112. package/dist/exports/atoms/std-validate-on-save.orb +623 -0
  113. package/dist/exports/molecules/std-quiz.orb +48 -24
  114. package/dist/exports/molecules/std-service-content-pipeline.orb +915 -0
  115. package/dist/exports/molecules/std-service-custom-api-tester.orb +860 -0
  116. package/dist/exports/molecules/std-service-devops-toolkit.orb +1526 -0
  117. package/dist/exports/molecules/std-service-notification-hub.orb +696 -0
  118. package/dist/exports/molecules/std-service-payment-flow.orb +873 -0
  119. package/dist/exports/organisms/std-service-marketplace.orb +5191 -0
  120. package/dist/exports/organisms/std-service-research-assistant.orb +3568 -0
  121. package/dist/exports/test-schemas/os-trigger-simulation.orb +202 -0
  122. package/dist/exports/validation-report.json +2 -2
  123. package/dist/index.d.ts +3 -3
  124. package/dist/index.js +7887 -2216
  125. package/dist/index.js.map +1 -1
  126. package/dist/modules/array.d.ts +1 -1
  127. package/dist/modules/async.d.ts +1 -1
  128. package/dist/modules/contract.d.ts +22 -0
  129. package/dist/modules/contract.js +100 -0
  130. package/dist/modules/contract.js.map +1 -0
  131. package/dist/modules/data.d.ts +22 -0
  132. package/dist/modules/data.js +117 -0
  133. package/dist/modules/data.js.map +1 -0
  134. package/dist/modules/format.d.ts +1 -1
  135. package/dist/modules/graph.d.ts +23 -0
  136. package/dist/modules/graph.js +209 -0
  137. package/dist/modules/graph.js.map +1 -0
  138. package/dist/modules/index.d.ts +5 -1
  139. package/dist/modules/index.js +593 -63
  140. package/dist/modules/index.js.map +1 -1
  141. package/dist/modules/math.d.ts +1 -1
  142. package/dist/modules/nn.d.ts +1 -1
  143. package/dist/modules/nn.js +14 -14
  144. package/dist/modules/nn.js.map +1 -1
  145. package/dist/modules/object.d.ts +1 -1
  146. package/dist/modules/os.d.ts +19 -0
  147. package/dist/modules/os.js +116 -0
  148. package/dist/modules/os.js.map +1 -0
  149. package/dist/modules/prob.d.ts +1 -1
  150. package/dist/modules/str.d.ts +1 -1
  151. package/dist/modules/tensor.d.ts +1 -1
  152. package/dist/modules/tensor.js +29 -29
  153. package/dist/modules/tensor.js.map +1 -1
  154. package/dist/modules/time.d.ts +1 -1
  155. package/dist/modules/train.d.ts +1 -1
  156. package/dist/modules/train.js +19 -19
  157. package/dist/modules/train.js.map +1 -1
  158. package/dist/modules/validate.d.ts +1 -1
  159. package/dist/registry.d.ts +2 -2
  160. package/dist/registry.js +184 -65
  161. package/dist/registry.js.map +1 -1
  162. package/dist/{types-CmNM_IbV.d.ts → types-DOeGXRCm.d.ts} +3 -3
  163. package/package.json +4 -4
@@ -0,0 +1,873 @@
1
+ {
2
+ "name": "ServicePaymentFlowOrbital",
3
+ "orbitals": [
4
+ {
5
+ "name": "ServicePaymentFlowOrbital",
6
+ "entity": {
7
+ "name": "ServicePaymentFlow",
8
+ "persistence": "runtime",
9
+ "fields": [
10
+ {
11
+ "name": "id",
12
+ "type": "string"
13
+ },
14
+ {
15
+ "name": "name",
16
+ "type": "string"
17
+ },
18
+ {
19
+ "name": "description",
20
+ "type": "string"
21
+ },
22
+ {
23
+ "name": "status",
24
+ "type": "string",
25
+ "default": "active",
26
+ "values": [
27
+ "active",
28
+ "inactive",
29
+ "pending"
30
+ ]
31
+ },
32
+ {
33
+ "name": "createdAt",
34
+ "type": "string"
35
+ },
36
+ {
37
+ "name": "amount",
38
+ "type": "number"
39
+ },
40
+ {
41
+ "name": "currency",
42
+ "type": "string",
43
+ "default": "usd"
44
+ },
45
+ {
46
+ "name": "paymentIntentId",
47
+ "type": "string"
48
+ },
49
+ {
50
+ "name": "clientSecret",
51
+ "type": "string"
52
+ },
53
+ {
54
+ "name": "paymentStatus",
55
+ "type": "string",
56
+ "default": "idle"
57
+ },
58
+ {
59
+ "name": "to",
60
+ "type": "string"
61
+ },
62
+ {
63
+ "name": "subject",
64
+ "type": "string",
65
+ "default": "Payment Receipt"
66
+ },
67
+ {
68
+ "name": "body",
69
+ "type": "string"
70
+ },
71
+ {
72
+ "name": "sendStatus",
73
+ "type": "string",
74
+ "default": "idle"
75
+ },
76
+ {
77
+ "name": "error",
78
+ "type": "string"
79
+ }
80
+ ]
81
+ },
82
+ "traits": [
83
+ {
84
+ "name": "ServicePaymentFlowPayment",
85
+ "linkedEntity": "ServicePaymentFlow",
86
+ "category": "interaction",
87
+ "emits": [
88
+ {
89
+ "event": "SEND_RECEIPT"
90
+ }
91
+ ],
92
+ "stateMachine": {
93
+ "states": [
94
+ {
95
+ "name": "idle",
96
+ "isInitial": true
97
+ },
98
+ {
99
+ "name": "creating"
100
+ },
101
+ {
102
+ "name": "confirming"
103
+ },
104
+ {
105
+ "name": "succeeded"
106
+ },
107
+ {
108
+ "name": "error"
109
+ }
110
+ ],
111
+ "events": [
112
+ {
113
+ "key": "INIT",
114
+ "name": "Initialize"
115
+ },
116
+ {
117
+ "key": "CREATE_PAYMENT",
118
+ "name": "Create Payment"
119
+ },
120
+ {
121
+ "key": "PAYMENT_CREATED",
122
+ "name": "Payment Created",
123
+ "payload": [
124
+ {
125
+ "name": "id",
126
+ "type": "string",
127
+ "required": true
128
+ },
129
+ {
130
+ "name": "clientSecret",
131
+ "type": "string",
132
+ "required": true
133
+ }
134
+ ]
135
+ },
136
+ {
137
+ "key": "PAYMENT_CONFIRMED",
138
+ "name": "Payment Confirmed"
139
+ },
140
+ {
141
+ "key": "FAILED",
142
+ "name": "Failed",
143
+ "payload": [
144
+ {
145
+ "name": "error",
146
+ "type": "string",
147
+ "required": true
148
+ }
149
+ ]
150
+ },
151
+ {
152
+ "key": "RETRY",
153
+ "name": "Retry"
154
+ },
155
+ {
156
+ "key": "RESET",
157
+ "name": "Reset"
158
+ }
159
+ ],
160
+ "transitions": [
161
+ {
162
+ "from": "idle",
163
+ "to": "idle",
164
+ "event": "INIT",
165
+ "effects": [
166
+ [
167
+ "fetch",
168
+ "ServicePaymentFlow"
169
+ ],
170
+ [
171
+ "render-ui",
172
+ "main",
173
+ {
174
+ "type": "stack",
175
+ "direction": "vertical",
176
+ "gap": "lg",
177
+ "align": "center",
178
+ "children": [
179
+ {
180
+ "type": "stack",
181
+ "direction": "horizontal",
182
+ "gap": "md",
183
+ "align": "center",
184
+ "children": [
185
+ {
186
+ "type": "icon",
187
+ "name": "credit-card",
188
+ "size": "lg"
189
+ },
190
+ {
191
+ "type": "typography",
192
+ "content": "Payment",
193
+ "variant": "h2"
194
+ }
195
+ ]
196
+ },
197
+ {
198
+ "type": "divider"
199
+ },
200
+ {
201
+ "type": "stack",
202
+ "direction": "vertical",
203
+ "gap": "md",
204
+ "children": [
205
+ {
206
+ "type": "input",
207
+ "label": "Amount",
208
+ "field": "amount",
209
+ "inputType": "number",
210
+ "placeholder": "0.00"
211
+ },
212
+ {
213
+ "type": "select",
214
+ "label": "Currency",
215
+ "field": "currency",
216
+ "options": [
217
+ {
218
+ "label": "USD",
219
+ "value": "usd"
220
+ },
221
+ {
222
+ "label": "EUR",
223
+ "value": "eur"
224
+ },
225
+ {
226
+ "label": "GBP",
227
+ "value": "gbp"
228
+ }
229
+ ]
230
+ }
231
+ ]
232
+ },
233
+ {
234
+ "type": "button",
235
+ "label": "Pay",
236
+ "event": "CREATE_PAYMENT",
237
+ "variant": "primary",
238
+ "icon": "credit-card"
239
+ }
240
+ ]
241
+ }
242
+ ]
243
+ ]
244
+ },
245
+ {
246
+ "from": "idle",
247
+ "to": "creating",
248
+ "event": "CREATE_PAYMENT",
249
+ "effects": [
250
+ [
251
+ "render-ui",
252
+ "main",
253
+ {
254
+ "type": "loading-state",
255
+ "title": "Creating payment...",
256
+ "message": "Setting up your payment intent."
257
+ }
258
+ ],
259
+ [
260
+ "call-service",
261
+ "stripe",
262
+ "createPaymentIntent",
263
+ {
264
+ "amount": "@entity.amount",
265
+ "currency": "@entity.currency"
266
+ }
267
+ ]
268
+ ]
269
+ },
270
+ {
271
+ "from": "creating",
272
+ "to": "confirming",
273
+ "event": "PAYMENT_CREATED",
274
+ "effects": [
275
+ [
276
+ "set",
277
+ "@entity.paymentIntentId",
278
+ "@payload.id"
279
+ ],
280
+ [
281
+ "set",
282
+ "@entity.clientSecret",
283
+ "@payload.clientSecret"
284
+ ],
285
+ [
286
+ "render-ui",
287
+ "main",
288
+ {
289
+ "type": "loading-state",
290
+ "title": "Confirming payment...",
291
+ "message": "Processing your payment."
292
+ }
293
+ ],
294
+ [
295
+ "call-service",
296
+ "stripe",
297
+ "confirmPayment",
298
+ {
299
+ "paymentIntentId": "@entity.paymentIntentId"
300
+ }
301
+ ]
302
+ ]
303
+ },
304
+ {
305
+ "from": "confirming",
306
+ "to": "succeeded",
307
+ "event": "PAYMENT_CONFIRMED",
308
+ "effects": [
309
+ [
310
+ "set",
311
+ "@entity.paymentStatus",
312
+ "succeeded"
313
+ ],
314
+ [
315
+ "emit",
316
+ "SEND_RECEIPT"
317
+ ],
318
+ [
319
+ "render-ui",
320
+ "main",
321
+ {
322
+ "type": "stack",
323
+ "direction": "vertical",
324
+ "gap": "lg",
325
+ "align": "center",
326
+ "children": [
327
+ {
328
+ "type": "icon",
329
+ "name": "check-circle",
330
+ "size": "lg"
331
+ },
332
+ {
333
+ "type": "alert",
334
+ "variant": "success",
335
+ "message": "Payment successful! Sending receipt..."
336
+ },
337
+ {
338
+ "type": "typography",
339
+ "variant": "body",
340
+ "color": "muted",
341
+ "content": "@entity.paymentIntentId"
342
+ },
343
+ {
344
+ "type": "button",
345
+ "label": "New Payment",
346
+ "event": "RESET",
347
+ "variant": "ghost",
348
+ "icon": "rotate-ccw"
349
+ }
350
+ ]
351
+ }
352
+ ]
353
+ ]
354
+ },
355
+ {
356
+ "from": "creating",
357
+ "to": "error",
358
+ "event": "FAILED",
359
+ "effects": [
360
+ [
361
+ "set",
362
+ "@entity.error",
363
+ "@payload.error"
364
+ ],
365
+ [
366
+ "render-ui",
367
+ "main",
368
+ {
369
+ "type": "error-state",
370
+ "title": "Payment Failed",
371
+ "message": "@entity.error",
372
+ "onRetry": "RETRY"
373
+ }
374
+ ]
375
+ ]
376
+ },
377
+ {
378
+ "from": "confirming",
379
+ "to": "error",
380
+ "event": "FAILED",
381
+ "effects": [
382
+ [
383
+ "set",
384
+ "@entity.error",
385
+ "@payload.error"
386
+ ],
387
+ [
388
+ "render-ui",
389
+ "main",
390
+ {
391
+ "type": "error-state",
392
+ "title": "Payment Failed",
393
+ "message": "@entity.error",
394
+ "onRetry": "RETRY"
395
+ }
396
+ ]
397
+ ]
398
+ },
399
+ {
400
+ "from": "error",
401
+ "to": "idle",
402
+ "event": "RETRY",
403
+ "effects": [
404
+ [
405
+ "render-ui",
406
+ "main",
407
+ {
408
+ "type": "stack",
409
+ "direction": "vertical",
410
+ "gap": "lg",
411
+ "align": "center",
412
+ "children": [
413
+ {
414
+ "type": "stack",
415
+ "direction": "horizontal",
416
+ "gap": "md",
417
+ "align": "center",
418
+ "children": [
419
+ {
420
+ "type": "icon",
421
+ "name": "credit-card",
422
+ "size": "lg"
423
+ },
424
+ {
425
+ "type": "typography",
426
+ "content": "Payment",
427
+ "variant": "h2"
428
+ }
429
+ ]
430
+ },
431
+ {
432
+ "type": "divider"
433
+ },
434
+ {
435
+ "type": "stack",
436
+ "direction": "vertical",
437
+ "gap": "md",
438
+ "children": [
439
+ {
440
+ "type": "input",
441
+ "label": "Amount",
442
+ "field": "amount",
443
+ "inputType": "number",
444
+ "placeholder": "0.00"
445
+ },
446
+ {
447
+ "type": "select",
448
+ "label": "Currency",
449
+ "field": "currency",
450
+ "options": [
451
+ {
452
+ "label": "USD",
453
+ "value": "usd"
454
+ },
455
+ {
456
+ "label": "EUR",
457
+ "value": "eur"
458
+ },
459
+ {
460
+ "label": "GBP",
461
+ "value": "gbp"
462
+ }
463
+ ]
464
+ }
465
+ ]
466
+ },
467
+ {
468
+ "type": "button",
469
+ "label": "Pay",
470
+ "event": "CREATE_PAYMENT",
471
+ "variant": "primary",
472
+ "icon": "credit-card"
473
+ }
474
+ ]
475
+ }
476
+ ]
477
+ ]
478
+ },
479
+ {
480
+ "from": "succeeded",
481
+ "to": "idle",
482
+ "event": "RESET",
483
+ "effects": [
484
+ [
485
+ "render-ui",
486
+ "main",
487
+ {
488
+ "type": "stack",
489
+ "direction": "vertical",
490
+ "gap": "lg",
491
+ "align": "center",
492
+ "children": [
493
+ {
494
+ "type": "stack",
495
+ "direction": "horizontal",
496
+ "gap": "md",
497
+ "align": "center",
498
+ "children": [
499
+ {
500
+ "type": "icon",
501
+ "name": "credit-card",
502
+ "size": "lg"
503
+ },
504
+ {
505
+ "type": "typography",
506
+ "content": "Payment",
507
+ "variant": "h2"
508
+ }
509
+ ]
510
+ },
511
+ {
512
+ "type": "divider"
513
+ },
514
+ {
515
+ "type": "stack",
516
+ "direction": "vertical",
517
+ "gap": "md",
518
+ "children": [
519
+ {
520
+ "type": "input",
521
+ "label": "Amount",
522
+ "field": "amount",
523
+ "inputType": "number",
524
+ "placeholder": "0.00"
525
+ },
526
+ {
527
+ "type": "select",
528
+ "label": "Currency",
529
+ "field": "currency",
530
+ "options": [
531
+ {
532
+ "label": "USD",
533
+ "value": "usd"
534
+ },
535
+ {
536
+ "label": "EUR",
537
+ "value": "eur"
538
+ },
539
+ {
540
+ "label": "GBP",
541
+ "value": "gbp"
542
+ }
543
+ ]
544
+ }
545
+ ]
546
+ },
547
+ {
548
+ "type": "button",
549
+ "label": "Pay",
550
+ "event": "CREATE_PAYMENT",
551
+ "variant": "primary",
552
+ "icon": "credit-card"
553
+ }
554
+ ]
555
+ }
556
+ ]
557
+ ]
558
+ },
559
+ {
560
+ "from": "error",
561
+ "to": "idle",
562
+ "event": "RESET",
563
+ "effects": [
564
+ [
565
+ "render-ui",
566
+ "main",
567
+ {
568
+ "type": "stack",
569
+ "direction": "vertical",
570
+ "gap": "lg",
571
+ "align": "center",
572
+ "children": [
573
+ {
574
+ "type": "stack",
575
+ "direction": "horizontal",
576
+ "gap": "md",
577
+ "align": "center",
578
+ "children": [
579
+ {
580
+ "type": "icon",
581
+ "name": "credit-card",
582
+ "size": "lg"
583
+ },
584
+ {
585
+ "type": "typography",
586
+ "content": "Payment",
587
+ "variant": "h2"
588
+ }
589
+ ]
590
+ },
591
+ {
592
+ "type": "divider"
593
+ },
594
+ {
595
+ "type": "stack",
596
+ "direction": "vertical",
597
+ "gap": "md",
598
+ "children": [
599
+ {
600
+ "type": "input",
601
+ "label": "Amount",
602
+ "field": "amount",
603
+ "inputType": "number",
604
+ "placeholder": "0.00"
605
+ },
606
+ {
607
+ "type": "select",
608
+ "label": "Currency",
609
+ "field": "currency",
610
+ "options": [
611
+ {
612
+ "label": "USD",
613
+ "value": "usd"
614
+ },
615
+ {
616
+ "label": "EUR",
617
+ "value": "eur"
618
+ },
619
+ {
620
+ "label": "GBP",
621
+ "value": "gbp"
622
+ }
623
+ ]
624
+ }
625
+ ]
626
+ },
627
+ {
628
+ "type": "button",
629
+ "label": "Pay",
630
+ "event": "CREATE_PAYMENT",
631
+ "variant": "primary",
632
+ "icon": "credit-card"
633
+ }
634
+ ]
635
+ }
636
+ ]
637
+ ]
638
+ }
639
+ ]
640
+ }
641
+ },
642
+ {
643
+ "name": "ServicePaymentFlowReceipt",
644
+ "linkedEntity": "ServicePaymentFlow",
645
+ "category": "interaction",
646
+ "listens": [
647
+ {
648
+ "event": "SEND_RECEIPT",
649
+ "triggers": "SEND_RECEIPT"
650
+ }
651
+ ],
652
+ "stateMachine": {
653
+ "states": [
654
+ {
655
+ "name": "waiting",
656
+ "isInitial": true
657
+ },
658
+ {
659
+ "name": "sending"
660
+ },
661
+ {
662
+ "name": "sent",
663
+ "isTerminal": true
664
+ },
665
+ {
666
+ "name": "receiptError"
667
+ }
668
+ ],
669
+ "events": [
670
+ {
671
+ "key": "INIT",
672
+ "name": "Initialize"
673
+ },
674
+ {
675
+ "key": "SEND_RECEIPT",
676
+ "name": "Send Receipt"
677
+ },
678
+ {
679
+ "key": "SENT",
680
+ "name": "Receipt Sent"
681
+ },
682
+ {
683
+ "key": "FAILED",
684
+ "name": "Send Failed",
685
+ "payload": [
686
+ {
687
+ "name": "error",
688
+ "type": "string",
689
+ "required": true
690
+ }
691
+ ]
692
+ },
693
+ {
694
+ "key": "RETRY_RECEIPT",
695
+ "name": "Retry Receipt"
696
+ }
697
+ ],
698
+ "transitions": [
699
+ {
700
+ "from": "waiting",
701
+ "to": "waiting",
702
+ "event": "INIT",
703
+ "effects": [
704
+ [
705
+ "render-ui",
706
+ "main",
707
+ {
708
+ "type": "stack",
709
+ "direction": "vertical",
710
+ "gap": "md",
711
+ "align": "center",
712
+ "children": [
713
+ {
714
+ "type": "icon",
715
+ "name": "mail",
716
+ "size": "md"
717
+ },
718
+ {
719
+ "type": "typography",
720
+ "content": "Receipt will be sent after payment.",
721
+ "variant": "body",
722
+ "color": "muted"
723
+ }
724
+ ]
725
+ }
726
+ ]
727
+ ]
728
+ },
729
+ {
730
+ "from": "waiting",
731
+ "to": "sending",
732
+ "event": "SEND_RECEIPT",
733
+ "effects": [
734
+ [
735
+ "render-ui",
736
+ "main",
737
+ {
738
+ "type": "loading-state",
739
+ "title": "Sending receipt...",
740
+ "message": "Delivering your payment receipt."
741
+ }
742
+ ],
743
+ [
744
+ "call-service",
745
+ "email",
746
+ "send",
747
+ {
748
+ "to": "@entity.to",
749
+ "subject": "@entity.subject",
750
+ "body": "@entity.body"
751
+ }
752
+ ]
753
+ ]
754
+ },
755
+ {
756
+ "from": "sending",
757
+ "to": "sent",
758
+ "event": "SENT",
759
+ "effects": [
760
+ [
761
+ "set",
762
+ "@entity.sendStatus",
763
+ "sent"
764
+ ],
765
+ [
766
+ "render-ui",
767
+ "main",
768
+ {
769
+ "type": "stack",
770
+ "direction": "vertical",
771
+ "gap": "md",
772
+ "align": "center",
773
+ "children": [
774
+ {
775
+ "type": "icon",
776
+ "name": "check-circle",
777
+ "size": "md"
778
+ },
779
+ {
780
+ "type": "alert",
781
+ "variant": "success",
782
+ "message": "Receipt sent successfully"
783
+ }
784
+ ]
785
+ }
786
+ ]
787
+ ]
788
+ },
789
+ {
790
+ "from": "sending",
791
+ "to": "receiptError",
792
+ "event": "FAILED",
793
+ "effects": [
794
+ [
795
+ "set",
796
+ "@entity.sendStatus",
797
+ "error"
798
+ ],
799
+ [
800
+ "render-ui",
801
+ "main",
802
+ {
803
+ "type": "stack",
804
+ "direction": "vertical",
805
+ "gap": "md",
806
+ "align": "center",
807
+ "children": [
808
+ {
809
+ "type": "error-state",
810
+ "title": "Receipt Failed",
811
+ "message": "Could not send receipt email.",
812
+ "onRetry": "RETRY_RECEIPT"
813
+ },
814
+ {
815
+ "type": "button",
816
+ "label": "Retry",
817
+ "event": "RETRY_RECEIPT",
818
+ "variant": "primary",
819
+ "icon": "refresh-cw"
820
+ }
821
+ ]
822
+ }
823
+ ]
824
+ ]
825
+ },
826
+ {
827
+ "from": "receiptError",
828
+ "to": "sending",
829
+ "event": "RETRY_RECEIPT",
830
+ "effects": [
831
+ [
832
+ "render-ui",
833
+ "main",
834
+ {
835
+ "type": "loading-state",
836
+ "title": "Sending receipt...",
837
+ "message": "Delivering your payment receipt."
838
+ }
839
+ ],
840
+ [
841
+ "call-service",
842
+ "email",
843
+ "send",
844
+ {
845
+ "to": "@entity.to",
846
+ "subject": "@entity.subject",
847
+ "body": "@entity.body"
848
+ }
849
+ ]
850
+ ]
851
+ }
852
+ ]
853
+ }
854
+ }
855
+ ],
856
+ "pages": [
857
+ {
858
+ "name": "ServicePaymentFlowPage",
859
+ "path": "/servicepaymentflows",
860
+ "traits": [
861
+ {
862
+ "ref": "ServicePaymentFlowPayment"
863
+ },
864
+ {
865
+ "ref": "ServicePaymentFlowReceipt"
866
+ }
867
+ ]
868
+ }
869
+ ]
870
+ }
871
+ ],
872
+ "description": "Payment flow molecule. Composes stripe payment and email receipt into a single orchestrated flow: pay, then auto-send receipt email. Two inline traits share one entity and one page: - Payment trait: idle -> creating -> confirming -> succeeded -> error Emits SEND_RECEIPT when payment is confirmed. - Receipt trait: waiting -> sending -> sent -> receiptError Listens for SEND_RECEIPT and calls the email service. Traits on the same page share the event bus automatically."
873
+ }