@shware/workflow-ui 0.0.0-stage → 0.1.0

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 (363) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +180 -2
  3. package/dist/assets/iphone-17-pro-DzaacWSl.png +0 -0
  4. package/dist/assets/pixel-10-pro-back-7MDj1_lz.webp +0 -0
  5. package/dist/assets/pixel-10-pro-mask-Bi1deQ9Y.webp +0 -0
  6. package/dist/cli.d.mts +1 -0
  7. package/dist/cli.mjs +673 -0
  8. package/dist/cli.mjs.map +1 -0
  9. package/dist/config.d.mts +247 -0
  10. package/dist/config.d.mts.map +1 -0
  11. package/dist/config.mjs +27 -0
  12. package/dist/config.mjs.map +1 -0
  13. package/dist/index.d.mts +451 -0
  14. package/dist/index.d.mts.map +1 -0
  15. package/dist/index.mjs +2722 -0
  16. package/dist/index.mjs.map +1 -0
  17. package/dist/postgres.d.mts +34 -0
  18. package/dist/postgres.d.mts.map +1 -0
  19. package/dist/postgres.mjs +313 -0
  20. package/dist/postgres.mjs.map +1 -0
  21. package/package.json +93 -3
  22. package/src/app/assets/devices/iphone-17-pro.png +0 -0
  23. package/src/app/assets/devices/pixel-10-pro-back.webp +0 -0
  24. package/src/app/assets/devices/pixel-10-pro-mask.webp +0 -0
  25. package/src/app/assets/flags/AC.svg +1 -0
  26. package/src/app/assets/flags/AD.svg +1 -0
  27. package/src/app/assets/flags/AE.svg +1 -0
  28. package/src/app/assets/flags/AF.svg +1 -0
  29. package/src/app/assets/flags/AG.svg +1 -0
  30. package/src/app/assets/flags/AI.svg +1 -0
  31. package/src/app/assets/flags/AL.svg +1 -0
  32. package/src/app/assets/flags/AM.svg +1 -0
  33. package/src/app/assets/flags/AO.svg +1 -0
  34. package/src/app/assets/flags/AQ.svg +1 -0
  35. package/src/app/assets/flags/AR.svg +1 -0
  36. package/src/app/assets/flags/AS.svg +1 -0
  37. package/src/app/assets/flags/AT.svg +1 -0
  38. package/src/app/assets/flags/AU.svg +1 -0
  39. package/src/app/assets/flags/AW.svg +1 -0
  40. package/src/app/assets/flags/AX.svg +1 -0
  41. package/src/app/assets/flags/AZ.svg +1 -0
  42. package/src/app/assets/flags/BA.svg +1 -0
  43. package/src/app/assets/flags/BB.svg +1 -0
  44. package/src/app/assets/flags/BD.svg +1 -0
  45. package/src/app/assets/flags/BE.svg +1 -0
  46. package/src/app/assets/flags/BF.svg +1 -0
  47. package/src/app/assets/flags/BG.svg +1 -0
  48. package/src/app/assets/flags/BH.svg +1 -0
  49. package/src/app/assets/flags/BI.svg +1 -0
  50. package/src/app/assets/flags/BJ.svg +1 -0
  51. package/src/app/assets/flags/BL.svg +1 -0
  52. package/src/app/assets/flags/BM.svg +1 -0
  53. package/src/app/assets/flags/BN.svg +1 -0
  54. package/src/app/assets/flags/BO.svg +1 -0
  55. package/src/app/assets/flags/BQ-BO.svg +1 -0
  56. package/src/app/assets/flags/BQ-SA.svg +1 -0
  57. package/src/app/assets/flags/BQ-SE.svg +1 -0
  58. package/src/app/assets/flags/BQ.svg +1 -0
  59. package/src/app/assets/flags/BR.svg +1 -0
  60. package/src/app/assets/flags/BS.svg +1 -0
  61. package/src/app/assets/flags/BT.svg +1 -0
  62. package/src/app/assets/flags/BV.svg +1 -0
  63. package/src/app/assets/flags/BW.svg +1 -0
  64. package/src/app/assets/flags/BY.svg +1 -0
  65. package/src/app/assets/flags/BZ.svg +1 -0
  66. package/src/app/assets/flags/CA.svg +1 -0
  67. package/src/app/assets/flags/CC.svg +1 -0
  68. package/src/app/assets/flags/CD.svg +1 -0
  69. package/src/app/assets/flags/CF.svg +1 -0
  70. package/src/app/assets/flags/CG.svg +1 -0
  71. package/src/app/assets/flags/CH.svg +1 -0
  72. package/src/app/assets/flags/CI.svg +1 -0
  73. package/src/app/assets/flags/CK.svg +1 -0
  74. package/src/app/assets/flags/CL.svg +1 -0
  75. package/src/app/assets/flags/CM.svg +1 -0
  76. package/src/app/assets/flags/CN.svg +1 -0
  77. package/src/app/assets/flags/CO.svg +1 -0
  78. package/src/app/assets/flags/CR.svg +1 -0
  79. package/src/app/assets/flags/CU.svg +1 -0
  80. package/src/app/assets/flags/CV.svg +1 -0
  81. package/src/app/assets/flags/CW.svg +1 -0
  82. package/src/app/assets/flags/CX.svg +1 -0
  83. package/src/app/assets/flags/CY.svg +1 -0
  84. package/src/app/assets/flags/CZ.svg +1 -0
  85. package/src/app/assets/flags/DE.svg +1 -0
  86. package/src/app/assets/flags/DJ.svg +1 -0
  87. package/src/app/assets/flags/DK.svg +1 -0
  88. package/src/app/assets/flags/DM.svg +1 -0
  89. package/src/app/assets/flags/DO.svg +1 -0
  90. package/src/app/assets/flags/DZ.svg +1 -0
  91. package/src/app/assets/flags/EC.svg +1 -0
  92. package/src/app/assets/flags/EE.svg +1 -0
  93. package/src/app/assets/flags/EG.svg +1 -0
  94. package/src/app/assets/flags/EH.svg +1 -0
  95. package/src/app/assets/flags/ER.svg +1 -0
  96. package/src/app/assets/flags/ES-CT.svg +1 -0
  97. package/src/app/assets/flags/ES.svg +1 -0
  98. package/src/app/assets/flags/ET.svg +1 -0
  99. package/src/app/assets/flags/EU.svg +1 -0
  100. package/src/app/assets/flags/FI.svg +1 -0
  101. package/src/app/assets/flags/FJ.svg +1 -0
  102. package/src/app/assets/flags/FK.svg +1 -0
  103. package/src/app/assets/flags/FM.svg +1 -0
  104. package/src/app/assets/flags/FO.svg +1 -0
  105. package/src/app/assets/flags/FR.svg +1 -0
  106. package/src/app/assets/flags/GA.svg +1 -0
  107. package/src/app/assets/flags/GB-ENG.svg +1 -0
  108. package/src/app/assets/flags/GB-NIR.svg +1 -0
  109. package/src/app/assets/flags/GB-SCT.svg +1 -0
  110. package/src/app/assets/flags/GB-WLS.svg +1 -0
  111. package/src/app/assets/flags/GB.svg +1 -0
  112. package/src/app/assets/flags/GD.svg +1 -0
  113. package/src/app/assets/flags/GE.svg +1 -0
  114. package/src/app/assets/flags/GF.svg +1 -0
  115. package/src/app/assets/flags/GG.svg +1 -0
  116. package/src/app/assets/flags/GH.svg +1 -0
  117. package/src/app/assets/flags/GI.svg +1 -0
  118. package/src/app/assets/flags/GL.svg +1 -0
  119. package/src/app/assets/flags/GM.svg +1 -0
  120. package/src/app/assets/flags/GN.svg +1 -0
  121. package/src/app/assets/flags/GP.svg +1 -0
  122. package/src/app/assets/flags/GQ.svg +1 -0
  123. package/src/app/assets/flags/GR.svg +1 -0
  124. package/src/app/assets/flags/GS.svg +1 -0
  125. package/src/app/assets/flags/GT.svg +1 -0
  126. package/src/app/assets/flags/GU.svg +1 -0
  127. package/src/app/assets/flags/GW.svg +1 -0
  128. package/src/app/assets/flags/GY.svg +1 -0
  129. package/src/app/assets/flags/HK.svg +1 -0
  130. package/src/app/assets/flags/HM.svg +1 -0
  131. package/src/app/assets/flags/HN.svg +1 -0
  132. package/src/app/assets/flags/HR.svg +1 -0
  133. package/src/app/assets/flags/HT.svg +1 -0
  134. package/src/app/assets/flags/HU.svg +1 -0
  135. package/src/app/assets/flags/IC.svg +1 -0
  136. package/src/app/assets/flags/ID.svg +1 -0
  137. package/src/app/assets/flags/IE.svg +1 -0
  138. package/src/app/assets/flags/IL.svg +1 -0
  139. package/src/app/assets/flags/IM.svg +1 -0
  140. package/src/app/assets/flags/IN.svg +1 -0
  141. package/src/app/assets/flags/IO.svg +1 -0
  142. package/src/app/assets/flags/IQ.svg +1 -0
  143. package/src/app/assets/flags/IR.svg +1 -0
  144. package/src/app/assets/flags/IS.svg +1 -0
  145. package/src/app/assets/flags/IT.svg +1 -0
  146. package/src/app/assets/flags/JE.svg +1 -0
  147. package/src/app/assets/flags/JM.svg +1 -0
  148. package/src/app/assets/flags/JO.svg +1 -0
  149. package/src/app/assets/flags/JP.svg +1 -0
  150. package/src/app/assets/flags/KE.svg +1 -0
  151. package/src/app/assets/flags/KG.svg +1 -0
  152. package/src/app/assets/flags/KH.svg +1 -0
  153. package/src/app/assets/flags/KI.svg +1 -0
  154. package/src/app/assets/flags/KM.svg +1 -0
  155. package/src/app/assets/flags/KN.svg +1 -0
  156. package/src/app/assets/flags/KP.svg +1 -0
  157. package/src/app/assets/flags/KR.svg +1 -0
  158. package/src/app/assets/flags/KW.svg +1 -0
  159. package/src/app/assets/flags/KY.svg +1 -0
  160. package/src/app/assets/flags/KZ.svg +1 -0
  161. package/src/app/assets/flags/LA.svg +1 -0
  162. package/src/app/assets/flags/LB.svg +1 -0
  163. package/src/app/assets/flags/LC.svg +1 -0
  164. package/src/app/assets/flags/LI.svg +1 -0
  165. package/src/app/assets/flags/LK.svg +1 -0
  166. package/src/app/assets/flags/LR.svg +1 -0
  167. package/src/app/assets/flags/LS.svg +1 -0
  168. package/src/app/assets/flags/LT.svg +1 -0
  169. package/src/app/assets/flags/LU.svg +1 -0
  170. package/src/app/assets/flags/LV.svg +1 -0
  171. package/src/app/assets/flags/LY.svg +1 -0
  172. package/src/app/assets/flags/MA.svg +1 -0
  173. package/src/app/assets/flags/MC.svg +1 -0
  174. package/src/app/assets/flags/MD.svg +1 -0
  175. package/src/app/assets/flags/ME.svg +1 -0
  176. package/src/app/assets/flags/MF.svg +1 -0
  177. package/src/app/assets/flags/MG.svg +1 -0
  178. package/src/app/assets/flags/MH.svg +1 -0
  179. package/src/app/assets/flags/MK.svg +1 -0
  180. package/src/app/assets/flags/ML.svg +1 -0
  181. package/src/app/assets/flags/MM.svg +1 -0
  182. package/src/app/assets/flags/MN.svg +1 -0
  183. package/src/app/assets/flags/MO.svg +1 -0
  184. package/src/app/assets/flags/MP.svg +1 -0
  185. package/src/app/assets/flags/MQ.svg +1 -0
  186. package/src/app/assets/flags/MR.svg +1 -0
  187. package/src/app/assets/flags/MS.svg +1 -0
  188. package/src/app/assets/flags/MT.svg +1 -0
  189. package/src/app/assets/flags/MU.svg +1 -0
  190. package/src/app/assets/flags/MV.svg +1 -0
  191. package/src/app/assets/flags/MW.svg +1 -0
  192. package/src/app/assets/flags/MX.svg +1 -0
  193. package/src/app/assets/flags/MY.svg +1 -0
  194. package/src/app/assets/flags/MZ.svg +1 -0
  195. package/src/app/assets/flags/NA.svg +1 -0
  196. package/src/app/assets/flags/NC.svg +1 -0
  197. package/src/app/assets/flags/NE.svg +1 -0
  198. package/src/app/assets/flags/NF.svg +1 -0
  199. package/src/app/assets/flags/NG.svg +1 -0
  200. package/src/app/assets/flags/NI.svg +1 -0
  201. package/src/app/assets/flags/NL.svg +1 -0
  202. package/src/app/assets/flags/NO.svg +1 -0
  203. package/src/app/assets/flags/NP.svg +1 -0
  204. package/src/app/assets/flags/NR.svg +1 -0
  205. package/src/app/assets/flags/NU.svg +1 -0
  206. package/src/app/assets/flags/NZ.svg +1 -0
  207. package/src/app/assets/flags/OM.svg +1 -0
  208. package/src/app/assets/flags/PA.svg +1 -0
  209. package/src/app/assets/flags/PE.svg +1 -0
  210. package/src/app/assets/flags/PF.svg +1 -0
  211. package/src/app/assets/flags/PG.svg +1 -0
  212. package/src/app/assets/flags/PH.svg +1 -0
  213. package/src/app/assets/flags/PK.svg +1 -0
  214. package/src/app/assets/flags/PL.svg +1 -0
  215. package/src/app/assets/flags/PM.svg +1 -0
  216. package/src/app/assets/flags/PN.svg +1 -0
  217. package/src/app/assets/flags/PR.svg +1 -0
  218. package/src/app/assets/flags/PS.svg +1 -0
  219. package/src/app/assets/flags/PT.svg +1 -0
  220. package/src/app/assets/flags/PW.svg +1 -0
  221. package/src/app/assets/flags/PY.svg +1 -0
  222. package/src/app/assets/flags/QA.svg +1 -0
  223. package/src/app/assets/flags/RE.svg +1 -0
  224. package/src/app/assets/flags/README.md +6 -0
  225. package/src/app/assets/flags/RO.svg +1 -0
  226. package/src/app/assets/flags/RS.svg +1 -0
  227. package/src/app/assets/flags/RU.svg +1 -0
  228. package/src/app/assets/flags/RW.svg +1 -0
  229. package/src/app/assets/flags/SA.svg +1 -0
  230. package/src/app/assets/flags/SB.svg +1 -0
  231. package/src/app/assets/flags/SC.svg +1 -0
  232. package/src/app/assets/flags/SD.svg +1 -0
  233. package/src/app/assets/flags/SE.svg +1 -0
  234. package/src/app/assets/flags/SG.svg +1 -0
  235. package/src/app/assets/flags/SH.svg +1 -0
  236. package/src/app/assets/flags/SI.svg +1 -0
  237. package/src/app/assets/flags/SJ.svg +1 -0
  238. package/src/app/assets/flags/SK.svg +1 -0
  239. package/src/app/assets/flags/SL.svg +1 -0
  240. package/src/app/assets/flags/SM.svg +1 -0
  241. package/src/app/assets/flags/SN.svg +1 -0
  242. package/src/app/assets/flags/SO.svg +1 -0
  243. package/src/app/assets/flags/SR.svg +1 -0
  244. package/src/app/assets/flags/SS.svg +1 -0
  245. package/src/app/assets/flags/ST.svg +1 -0
  246. package/src/app/assets/flags/SV.svg +1 -0
  247. package/src/app/assets/flags/SX.svg +1 -0
  248. package/src/app/assets/flags/SY.svg +1 -0
  249. package/src/app/assets/flags/SZ.svg +1 -0
  250. package/src/app/assets/flags/TA.svg +1 -0
  251. package/src/app/assets/flags/TC.svg +1 -0
  252. package/src/app/assets/flags/TD.svg +1 -0
  253. package/src/app/assets/flags/TF.svg +1 -0
  254. package/src/app/assets/flags/TG.svg +1 -0
  255. package/src/app/assets/flags/TH.svg +1 -0
  256. package/src/app/assets/flags/TJ.svg +1 -0
  257. package/src/app/assets/flags/TK.svg +1 -0
  258. package/src/app/assets/flags/TL.svg +1 -0
  259. package/src/app/assets/flags/TM.svg +1 -0
  260. package/src/app/assets/flags/TN.svg +1 -0
  261. package/src/app/assets/flags/TO.svg +1 -0
  262. package/src/app/assets/flags/TR.svg +1 -0
  263. package/src/app/assets/flags/TT.svg +1 -0
  264. package/src/app/assets/flags/TV.svg +1 -0
  265. package/src/app/assets/flags/TW.svg +1 -0
  266. package/src/app/assets/flags/TZ.svg +1 -0
  267. package/src/app/assets/flags/UA.svg +1 -0
  268. package/src/app/assets/flags/UG.svg +1 -0
  269. package/src/app/assets/flags/UM.svg +1 -0
  270. package/src/app/assets/flags/US.svg +1 -0
  271. package/src/app/assets/flags/UY.svg +1 -0
  272. package/src/app/assets/flags/UZ.svg +1 -0
  273. package/src/app/assets/flags/VA.svg +1 -0
  274. package/src/app/assets/flags/VC.svg +1 -0
  275. package/src/app/assets/flags/VE.svg +1 -0
  276. package/src/app/assets/flags/VG.svg +1 -0
  277. package/src/app/assets/flags/VI.svg +1 -0
  278. package/src/app/assets/flags/VN.svg +1 -0
  279. package/src/app/assets/flags/VU.svg +1 -0
  280. package/src/app/assets/flags/WF.svg +1 -0
  281. package/src/app/assets/flags/WS.svg +1 -0
  282. package/src/app/assets/flags/XA.svg +1 -0
  283. package/src/app/assets/flags/XC.svg +1 -0
  284. package/src/app/assets/flags/XK.svg +1 -0
  285. package/src/app/assets/flags/XO.svg +1 -0
  286. package/src/app/assets/flags/YE.svg +1 -0
  287. package/src/app/assets/flags/YT.svg +1 -0
  288. package/src/app/assets/flags/ZA.svg +1 -0
  289. package/src/app/assets/flags/ZM.svg +1 -0
  290. package/src/app/assets/flags/ZW.svg +1 -0
  291. package/src/app/email-preview.ts +46 -0
  292. package/src/app/index.css +203 -0
  293. package/src/app/index.html +12 -0
  294. package/src/app/integrations/i18n/react-i18next.d.ts +11 -0
  295. package/src/app/integrations/i18n/root-provider.tsx +62 -0
  296. package/src/app/integrations/tanstack-query/devtools.tsx +6 -0
  297. package/src/app/integrations/tanstack-query/root-provider.tsx +37 -0
  298. package/src/app/integrations/theme/root-provider.tsx +75 -0
  299. package/src/app/integrations/toast/toast-provider.tsx +46 -0
  300. package/src/app/locales/en-US/common.ts +268 -0
  301. package/src/app/locales/zh-CN/common.ts +263 -0
  302. package/src/app/main.tsx +40 -0
  303. package/src/app/page-chrome.tsx +79 -0
  304. package/src/app/router.tsx +40 -0
  305. package/src/app/routes/__root.tsx +293 -0
  306. package/src/app/routes/emails.tsx +199 -0
  307. package/src/app/routes/home.tsx +87 -0
  308. package/src/app/routes/index.ts +19 -0
  309. package/src/app/routes/metrics.tsx +541 -0
  310. package/src/app/routes/segment-overview.tsx +211 -0
  311. package/src/app/routes/segments.tsx +236 -0
  312. package/src/app/routes/settings.tsx +90 -0
  313. package/src/app/routes/workflows.tsx +348 -0
  314. package/src/app/studio.ts +16 -0
  315. package/src/app/svg.d.ts +17 -0
  316. package/src/app/virtual-config.d.ts +6 -0
  317. package/src/cli.ts +110 -0
  318. package/src/components/avatar.tsx +57 -0
  319. package/src/components/breadcrumb.tsx +49 -0
  320. package/src/components/button/index.tsx +86 -0
  321. package/src/components/channel-icon.ts +39 -0
  322. package/src/components/chat-markup.tsx +109 -0
  323. package/src/components/corner-shape.ts +13 -0
  324. package/src/components/date-range.tsx +181 -0
  325. package/src/components/discord-preview.tsx +165 -0
  326. package/src/components/dropdown/index.tsx +172 -0
  327. package/src/components/email-defaults.tsx +40 -0
  328. package/src/components/email-list.tsx +149 -0
  329. package/src/components/email-thumbnail.tsx +123 -0
  330. package/src/components/flag.tsx +40 -0
  331. package/src/components/input/index.tsx +40 -0
  332. package/src/components/input/search-input.tsx +24 -0
  333. package/src/components/layout.ts +403 -0
  334. package/src/components/menu/index.tsx +118 -0
  335. package/src/components/metric-card.tsx +321 -0
  336. package/src/components/modal/index.tsx +70 -0
  337. package/src/components/nav-drawer.tsx +84 -0
  338. package/src/components/node-inspector.tsx +242 -0
  339. package/src/components/profile-drawer.tsx +331 -0
  340. package/src/components/push-preview.tsx +470 -0
  341. package/src/components/push-thumbnail.tsx +78 -0
  342. package/src/components/segment-list.tsx +184 -0
  343. package/src/components/select/index.tsx +70 -0
  344. package/src/components/series-chart.tsx +120 -0
  345. package/src/components/slack-preview.tsx +223 -0
  346. package/src/components/sparkline.tsx +58 -0
  347. package/src/components/tabs/index.tsx +45 -0
  348. package/src/components/template-refs.ts +110 -0
  349. package/src/components/templates-page.tsx +601 -0
  350. package/src/components/textarea/index.tsx +37 -0
  351. package/src/components/thumbnail-window.tsx +65 -0
  352. package/src/components/workflow-canvas.tsx +503 -0
  353. package/src/components/workflow-list.tsx +231 -0
  354. package/src/config.ts +288 -0
  355. package/src/generate.ts +56 -0
  356. package/src/index.ts +35 -0
  357. package/src/postgres.ts +415 -0
  358. package/src/server/project.ts +290 -0
  359. package/src/server.ts +500 -0
  360. package/src/utils/cn.ts +6 -0
  361. package/src/utils/label.ts +12 -0
  362. package/src/utils/lookup.ts +11 -0
  363. package/src/utils/template-content.ts +213 -0
@@ -0,0 +1,313 @@
1
+ import { defineStats } from "./config.mjs";
2
+ import { resolveRuntime } from "@shware/workflow";
3
+ import { DEFAULT_SCHEMA } from "@shware/workflow/store";
4
+ import postgres from "postgres";
5
+ //#region src/postgres.ts
6
+ /** A calendar day `count` days from a `YYYY-MM-DD` one: plain date math, no zone in it. */
7
+ const addDays = (day, count) => new Date(Date.parse(`${day}T00:00:00Z`) + count * 864e5).toISOString().slice(0, 10);
8
+ /**
9
+ * One pool per database across reloads: the dev server re-evaluates the stats module on every
10
+ * config change, and a pool per evaluation kept its connections open until Postgres ran out.
11
+ */
12
+ const pools = globalThis.__workflowStatsPools ??= /* @__PURE__ */ new Map();
13
+ function pool(connectionString) {
14
+ let sql = pools.get(connectionString);
15
+ if (sql === void 0) {
16
+ sql = postgres(connectionString, {
17
+ max: 4,
18
+ idle_timeout: 20,
19
+ fetch_types: false
20
+ });
21
+ pools.set(connectionString, sql);
22
+ }
23
+ return sql;
24
+ }
25
+ function postgresStats(options) {
26
+ const sql = pool(options.connectionString);
27
+ const schema = options.config.database?.schema ?? DEFAULT_SCHEMA;
28
+ /** A table of the engine's schema. */
29
+ const t = (name) => sql(`${schema}.${name}`);
30
+ const scale = resolveRuntime(options.config.runtime, options.environment ?? "development").timeScale;
31
+ const timeZone = options.timeZone ?? Intl.DateTimeFormat().resolvedOptions().timeZone;
32
+ /**
33
+ * The moment the journey clock reads "now": the latest activity in the data, so a
34
+ * fast-forwarded run keeps reading as the history up to today however long ago it ran —
35
+ * anchored on the real now instead, a run from last night had drifted hundreds of journey days
36
+ * out of every range by morning. Refreshed at the start of every call; with scale 1 it is now.
37
+ */
38
+ let anchor = Date.now();
39
+ async function refreshAnchor() {
40
+ if (scale === 1) {
41
+ anchor = Date.now();
42
+ return;
43
+ }
44
+ const [row] = await sql`
45
+ select greatest(
46
+ (select max(sent_at) from ${t("message")}),
47
+ (select max(node_at) from ${t("instance")}),
48
+ (select max(finished_at) from ${t("instance")}),
49
+ (select max(taken_at) from ${t("segment_snapshot")})
50
+ ) as latest`;
51
+ const latest = row?.latest === null || row?.latest === void 0 ? Date.now() : new Date(row.latest).getTime();
52
+ anchor = Math.min(latest, Date.now());
53
+ }
54
+ /** An instant on the journey's clock: `now - (anchor - t) × timeScale`. */
55
+ const onJourneyClock = (instant) => sql`(${(/* @__PURE__ */ new Date()).toISOString()}::timestamptz - (${new Date(anchor).toISOString()}::timestamptz - ${instant}) * ${scale}::float)`;
56
+ const virtual = (column) => onJourneyClock(sql`${sql(column)}`);
57
+ /** A column on the journey's clock, as a wall-clock time in the viewer's zone. */
58
+ const local = (column) => sql`(${virtual(column)} at time zone ${timeZone})`;
59
+ /** `YYYY-MM-DD` of an instant in the viewer's zone. */
60
+ const localDate = (ms) => new Intl.DateTimeFormat("en-CA", {
61
+ timeZone,
62
+ year: "numeric",
63
+ month: "2-digit",
64
+ day: "2-digit"
65
+ }).format(ms);
66
+ /** The instant a local calendar day starts. */
67
+ function startOfLocalDay(day) {
68
+ const utcMidnight = Date.parse(`${day}T00:00:00Z`);
69
+ const parts = Object.fromEntries(new Intl.DateTimeFormat("en-US", {
70
+ timeZone,
71
+ hourCycle: "h23",
72
+ year: "numeric",
73
+ month: "2-digit",
74
+ day: "2-digit",
75
+ hour: "2-digit",
76
+ minute: "2-digit",
77
+ second: "2-digit"
78
+ }).formatToParts(utcMidnight).map((part) => [part.type, part.value]));
79
+ const n = (type) => Number(parts[type] ?? 0);
80
+ return utcMidnight - (Date.UTC(n("year"), n("month") - 1, n("day"), n("hour"), n("minute"), n("second")) - utcMidnight);
81
+ }
82
+ /** The real instants a virtual `YYYY-MM-DD` range (both ends inclusive, local days) covers. */
83
+ function realRange({ from, to }) {
84
+ const now = Date.now();
85
+ const back = (ms) => new Date(anchor - (now - ms) / scale).toISOString();
86
+ return {
87
+ from: back(startOfLocalDay(from)),
88
+ to: back(startOfLocalDay(addDays(to, 1)))
89
+ };
90
+ }
91
+ /**
92
+ * When a copy reached its recipient: the transport's acceptance for email and Android, the
93
+ * device's own report for iOS and the web — a push APNs or a push service accepted can still
94
+ * never arrive (the app was deleted, the device stayed off). An app version without the
95
+ * reporting extension shows its iOS pushes undelivered.
96
+ */
97
+ const reached = sql`(case when m.channel in ('push_ios', 'push_web') then m.device_delivered_at else m.delivered_at end)`;
98
+ /**
99
+ * A converted instance: `converted_at` is set whatever the status (with `exitOnMatch: false` a
100
+ * conversion ends `completed`); rows written before the column existed only had status `goal`.
101
+ */
102
+ const converted = sql`(converted_at is not null or status = 'goal')`;
103
+ const channelFilter = (channel) => channel === void 0 ? sql`true` : sql`m.channel = ${channel}`;
104
+ /** The last 14 journey days, oldest first, as local `YYYY-MM-DD`. */
105
+ function lastDays(count = 14) {
106
+ const today = localDate(Date.now());
107
+ return Array.from({ length: count }, (_, i) => addDays(today, i - (count - 1)));
108
+ }
109
+ return defineStats({
110
+ async reports() {
111
+ await refreshAnchor();
112
+ const totals = await sql`
113
+ select workflow as id,
114
+ count(*)::int as entered,
115
+ count(*) filter (where status = 'running')::int as active,
116
+ count(*) filter (where status in ('completed', 'exited', 'exit_when', 'goal'))::int as completed,
117
+ count(*) filter (where ${converted})::int as converted
118
+ from ${t("instance")} group by workflow`;
119
+ const engagement = await sql`
120
+ select workflow as id,
121
+ count(${reached})::int as delivered,
122
+ count(opened_at) filter (where ${reached} is not null)::int as opened,
123
+ count(clicked_at) filter (where ${reached} is not null)::int as clicked
124
+ from ${t("message")} m group by workflow`;
125
+ const days = lastDays();
126
+ const series = await sql`
127
+ select workflow as id, to_char(${local("delivered_at")}, 'YYYY-MM-DD') as day,
128
+ count(${reached})::int as delivered,
129
+ count(opened_at) filter (where ${reached} is not null)::int as opened,
130
+ count(clicked_at) filter (where ${reached} is not null)::int as clicked
131
+ from ${t("message")} m where delivered_at is not null
132
+ group by 1, 2`;
133
+ const conversions = await sql`
134
+ select workflow as id,
135
+ to_char(${onJourneyClock(sql`coalesce(converted_at, finished_at)`)} at time zone ${timeZone}, 'YYYY-MM-DD') as day,
136
+ count(*)::int as converted
137
+ from ${t("instance")} where ${converted} group by 1, 2`;
138
+ const daily = (id, rows, key) => days.map((day) => rows.find((r) => r.id === id && r.day === day)?.[key] ?? 0);
139
+ return totals.map((total) => {
140
+ const e = engagement.find((row) => row.id === total.id);
141
+ return {
142
+ id: total.id,
143
+ entered: total.entered,
144
+ active: total.active,
145
+ completed: total.completed,
146
+ converted: total.converted,
147
+ delivered: e?.delivered ?? 0,
148
+ opened: e?.opened ?? 0,
149
+ clicked: e?.clicked ?? 0,
150
+ series: {
151
+ delivered: daily(total.id, series, "delivered"),
152
+ opened: daily(total.id, series, "opened"),
153
+ clicked: daily(total.id, series, "clicked"),
154
+ converted: daily(total.id, conversions, "converted")
155
+ }
156
+ };
157
+ });
158
+ },
159
+ async nodeStats(workflow) {
160
+ await refreshAnchor();
161
+ const rows = await sql`
162
+ select node_id, count(*)::int as users from ${t("instance")}
163
+ where workflow = ${workflow} and status = 'running' and node_id is not null
164
+ group by node_id`;
165
+ return Object.fromEntries(rows.map((row) => [row.node_id, row.users]));
166
+ },
167
+ async metrics(workflow, query) {
168
+ await refreshAnchor();
169
+ const { from, to } = realRange(query);
170
+ const unit = query.granularity;
171
+ const bucket = (column) => sql`to_char(date_trunc(${unit}, ${local(column)}), 'YYYY-MM-DD')`;
172
+ const messages = await sql`
173
+ with m as (
174
+ select * from ${t("message")} m
175
+ where m.workflow = ${workflow} and ${channelFilter(query.channel)}
176
+ ),
177
+ events as (
178
+ select ${bucket("sent_at")} as day, 'sent' as kind, false as human from m
179
+ where sent_at between ${from} and ${to}
180
+ union all select ${bucket("delivered_at")}, 'delivered', false from m
181
+ where ${reached} is not null and delivered_at between ${from} and ${to}
182
+ -- Opens and clicks count against the bucket the message was delivered in (its cohort),
183
+ -- not the day they happened: the rates drawn are opened / delivered, and an open
184
+ -- counted on another day than its delivery reads as 160% on a quiet day
185
+ union all select ${bucket("delivered_at")}, 'opened', human_opened_at is not null from m
186
+ where opened_at is not null and ${reached} is not null and delivered_at between ${from} and ${to}
187
+ union all select ${bucket("delivered_at")}, 'clicked', human_clicked_at is not null from m
188
+ where clicked_at is not null and ${reached} is not null and delivered_at between ${from} and ${to}
189
+ )
190
+ select day,
191
+ count(*) filter (where kind = 'sent')::int as sent,
192
+ count(*) filter (where kind = 'delivered')::int as delivered,
193
+ count(*) filter (where kind = 'opened')::int as opened,
194
+ count(*) filter (where kind = 'opened' and human)::int as opened_human,
195
+ count(*) filter (where kind = 'clicked')::int as clicked,
196
+ count(*) filter (where kind = 'clicked' and human)::int as clicked_human
197
+ from events group by day`;
198
+ const cohorts = await sql`
199
+ select ${bucket("entered_at")} as day, count(*)::int as entered,
200
+ count(*) filter (where ${converted})::int as converted
201
+ from ${t("instance")}
202
+ where workflow = ${workflow} and entered_at between ${from} and ${to}
203
+ group by 1`;
204
+ return (await sql`
205
+ select to_char(d, 'YYYY-MM-DD') as day
206
+ from generate_series(date_trunc(${unit}, ${query.from}::date), ${query.to}::date, ${`1 ${unit}`}::interval) d`).map(({ day }) => {
207
+ const m = messages.find((row) => row.day === day);
208
+ const opened = m?.opened ?? 0;
209
+ const clicked = m?.clicked ?? 0;
210
+ const cohort = cohorts.find((row) => row.day === day);
211
+ return {
212
+ date: day,
213
+ sent: m?.sent ?? 0,
214
+ delivered: m?.delivered ?? 0,
215
+ opened,
216
+ openedHuman: m?.opened_human ?? 0,
217
+ openedMachine: opened - (m?.opened_human ?? 0),
218
+ clicked,
219
+ clickedHuman: m?.clicked_human ?? 0,
220
+ clickedMachine: clicked - (m?.clicked_human ?? 0),
221
+ entered: cohort?.entered ?? 0,
222
+ converted: cohort?.converted ?? 0
223
+ };
224
+ });
225
+ },
226
+ async links(workflow, query) {
227
+ await refreshAnchor();
228
+ const { from, to } = realRange(query);
229
+ return sql`
230
+ select c.url, count(*)::int as clicks
231
+ from ${t("message_click")} c
232
+ join ${t("message")} m on m.id = c.message_id
233
+ where m.workflow = ${workflow} and ${channelFilter(query.channel)}
234
+ and c.clicked_at between ${from} and ${to}
235
+ -- People's clicks only: a scanner follows every link, the footer's included
236
+ and not c.machine
237
+ group by c.url order by clicks desc limit 50`;
238
+ },
239
+ async messages(workflow, query) {
240
+ await refreshAnchor();
241
+ const { from, to } = realRange(query);
242
+ return sql`
243
+ select node_id as "nodeId", template, channel,
244
+ count(*)::int as sent,
245
+ count(${reached})::int as delivered,
246
+ count(opened_at) filter (where ${reached} is not null)::int as opened,
247
+ count(clicked_at) filter (where ${reached} is not null)::int as clicked,
248
+ count(unsubscribed_at)::int as unsubscribed
249
+ from ${t("message")} m
250
+ where m.workflow = ${workflow} and ${channelFilter(query.channel)}
251
+ and m.sent_at between ${from} and ${to}
252
+ group by node_id, template, channel order by node_id, channel`;
253
+ },
254
+ async segments() {
255
+ await refreshAnchor();
256
+ const sizes = await sql`
257
+ select s.id, count(m.user_id)::int as size
258
+ from ${t("segment")} s
259
+ left join ${t("segment_member")} m on m.segment = s.id
260
+ group by s.id`;
261
+ const days = lastDays();
262
+ const snapshots = await sql`
263
+ select distinct on (segment, day) segment as id, day, size from (
264
+ select segment, size, taken_at, to_char(${local("taken_at")}, 'YYYY-MM-DD') as day
265
+ from ${t("segment_snapshot")}
266
+ ) s order by segment, day, taken_at desc`;
267
+ return sizes.map(({ id, size }) => {
268
+ let last = 0;
269
+ return {
270
+ id,
271
+ size,
272
+ series: days.map((day) => {
273
+ last = snapshots.find((s) => s.id === id && s.day === day)?.size ?? last;
274
+ return last;
275
+ })
276
+ };
277
+ });
278
+ },
279
+ async profiles(segment, { limit, offset }) {
280
+ await refreshAnchor();
281
+ const [count] = await sql`
282
+ select count(*)::int as total from ${t("segment_member")} where segment = ${segment}`;
283
+ const rows = await sql`
284
+ select m.user_id as id, p.props,
285
+ ${onJourneyClock(sql`first_event.ts`)} as created_at
286
+ from ${t("segment_member")} m
287
+ left join ${t("profile")} p on p.user_id = m.user_id
288
+ left join lateral (
289
+ select min(ts) as ts from ${t("event")} e where e.user_id = m.user_id
290
+ ) first_event on true
291
+ where m.segment = ${segment}
292
+ order by m.ts desc, m.user_id
293
+ limit ${limit} offset ${offset}`;
294
+ return {
295
+ total: count?.total ?? 0,
296
+ profiles: rows.map(({ id, props, created_at }) => {
297
+ const { email, ...properties } = props ?? {};
298
+ const profile = {
299
+ id,
300
+ properties
301
+ };
302
+ if (typeof email === "string") profile.email = email;
303
+ if (created_at !== null) profile.createdAt = new Date(created_at).toISOString();
304
+ return profile;
305
+ })
306
+ };
307
+ }
308
+ });
309
+ }
310
+ //#endregion
311
+ export { postgresStats };
312
+
313
+ //# sourceMappingURL=postgres.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postgres.mjs","names":[],"sources":["../src/postgres.ts"],"sourcesContent":["import { type JourneyConfig, resolveRuntime } from '@shware/workflow';\nimport { DEFAULT_SCHEMA } from '@shware/workflow/store';\nimport postgres from 'postgres';\nimport {\n type Granularity,\n type MetricChannel,\n type StatsRange,\n type StatsSource,\n defineStats,\n} from './config';\n\n/**\n * `@shware/workflow-ui/postgres` — the Studio's numbers read straight from the reporting a\n * journeyWorker on Postgres keeps (the engine's schema, `database.schema` in the config). The\n * Studio runs a stats source on its dev server, never in the browser, so it connects with a real\n * connection string:\n *\n * // workflow.stats.ts\n * export default postgresStats({ config, connectionString: process.env.STATS_DATABASE_URL });\n *\n * Time: a fast-forwarded environment (`runtime.<environment>.timeScale`) plays a journey day out\n * in minutes, so every timestamp is read on the journey's clock — `now - (anchor - t) ×\n * timeScale`, the anchor being the latest activity — and the Studio's date ranges are mapped back\n * the same way. A local run of an hour then reads as weeks of history; production (scale 1) is\n * unchanged.\n *\n * Days: the Studio's dates are the viewer's calendar days, so buckets are cut in the same time\n * zone (this machine's by default). Cut in UTC instead, \"today\" east of Greenwich is an empty\n * bucket on every chart.\n */\n\nexport interface PostgresStatsOptions {\n /** The project's `workflow.config.ts`: its database schema, and the runtime's time scale. */\n config: JourneyConfig;\n connectionString: string;\n /** Which `runtime` entry the data was written under; `development` by default. */\n environment?: string;\n /** The zone the Studio's days are cut in; this machine's by default. */\n timeZone?: string;\n}\n\n/** A calendar day `count` days from a `YYYY-MM-DD` one: plain date math, no zone in it. */\nconst addDays = (day: string, count: number) =>\n new Date(Date.parse(`${day}T00:00:00Z`) + count * 86_400_000).toISOString().slice(0, 10);\n\n/**\n * One pool per database across reloads: the dev server re-evaluates the stats module on every\n * config change, and a pool per evaluation kept its connections open until Postgres ran out.\n */\nconst pools = ((\n globalThis as { __workflowStatsPools?: Map<string, postgres.Sql> }\n).__workflowStatsPools ??= new Map());\n\nfunction pool(connectionString: string): postgres.Sql {\n let sql = pools.get(connectionString);\n if (sql === undefined) {\n sql = postgres(connectionString, { max: 4, idle_timeout: 20, fetch_types: false });\n pools.set(connectionString, sql);\n }\n return sql;\n}\n\nexport function postgresStats(options: PostgresStatsOptions): StatsSource {\n const sql = pool(options.connectionString);\n const schema = options.config.database?.schema ?? DEFAULT_SCHEMA;\n /** A table of the engine's schema. */\n const t = (name: string) => sql(`${schema}.${name}`);\n const scale = resolveRuntime(\n options.config.runtime,\n options.environment ?? 'development'\n ).timeScale;\n const timeZone = options.timeZone ?? Intl.DateTimeFormat().resolvedOptions().timeZone;\n\n /**\n * The moment the journey clock reads \"now\": the latest activity in the data, so a\n * fast-forwarded run keeps reading as the history up to today however long ago it ran —\n * anchored on the real now instead, a run from last night had drifted hundreds of journey days\n * out of every range by morning. Refreshed at the start of every call; with scale 1 it is now.\n */\n let anchor = Date.now();\n\n async function refreshAnchor(): Promise<void> {\n if (scale === 1) {\n anchor = Date.now();\n return;\n }\n const [row] = await sql<{ latest: Date | null }[]>`\n select greatest(\n (select max(sent_at) from ${t('message')}),\n (select max(node_at) from ${t('instance')}),\n (select max(finished_at) from ${t('instance')}),\n (select max(taken_at) from ${t('segment_snapshot')})\n ) as latest`;\n const latest =\n row?.latest === null || row?.latest === undefined\n ? Date.now()\n : new Date(row.latest).getTime();\n anchor = Math.min(latest, Date.now());\n }\n\n /** An instant on the journey's clock: `now - (anchor - t) × timeScale`. */\n const onJourneyClock = (instant: postgres.PendingQuery<postgres.Row[]>) =>\n sql`(${new Date().toISOString()}::timestamptz - (${new Date(anchor).toISOString()}::timestamptz - ${instant}) * ${scale}::float)`;\n const virtual = (column: string) => onJourneyClock(sql`${sql(column)}`);\n\n /** A column on the journey's clock, as a wall-clock time in the viewer's zone. */\n const local = (column: string) => sql`(${virtual(column)} at time zone ${timeZone})`;\n\n /** `YYYY-MM-DD` of an instant in the viewer's zone. */\n const localDate = (ms: number) =>\n new Intl.DateTimeFormat('en-CA', {\n timeZone,\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n }).format(ms);\n\n /** The instant a local calendar day starts. */\n function startOfLocalDay(day: string): number {\n const utcMidnight = Date.parse(`${day}T00:00:00Z`);\n // The zone's offset at that moment: how far its wall clock reads from UTC\n const parts = Object.fromEntries(\n new Intl.DateTimeFormat('en-US', {\n timeZone,\n hourCycle: 'h23',\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n })\n .formatToParts(utcMidnight)\n .map((part) => [part.type, part.value])\n );\n const n = (type: string) => Number(parts[type] ?? 0);\n const wall = Date.UTC(n('year'), n('month') - 1, n('day'), n('hour'), n('minute'), n('second'));\n return utcMidnight - (wall - utcMidnight);\n }\n\n /** The real instants a virtual `YYYY-MM-DD` range (both ends inclusive, local days) covers. */\n function realRange({ from, to }: StatsRange): { from: string; to: string } {\n const now = Date.now();\n const back = (ms: number) => new Date(anchor - (now - ms) / scale).toISOString();\n // The end is the start of the next local day, not 24 hours on: a DST day is 23 or 25\n return { from: back(startOfLocalDay(from)), to: back(startOfLocalDay(addDays(to, 1))) };\n }\n\n /**\n * When a copy reached its recipient: the transport's acceptance for email and Android, the\n * device's own report for iOS and the web — a push APNs or a push service accepted can still\n * never arrive (the app was deleted, the device stayed off). An app version without the\n * reporting extension shows its iOS pushes undelivered.\n */\n const reached = sql`(case when m.channel in ('push_ios', 'push_web') then m.device_delivered_at else m.delivered_at end)`;\n\n /**\n * A converted instance: `converted_at` is set whatever the status (with `exitOnMatch: false` a\n * conversion ends `completed`); rows written before the column existed only had status `goal`.\n */\n const converted = sql`(converted_at is not null or status = 'goal')`;\n\n const channelFilter = (channel: MetricChannel | undefined) =>\n channel === undefined ? sql`true` : sql`m.channel = ${channel}`;\n\n /** The last 14 journey days, oldest first, as local `YYYY-MM-DD`. */\n function lastDays(count = 14): string[] {\n const today = localDate(Date.now());\n return Array.from({ length: count }, (_, i) => addDays(today, i - (count - 1)));\n }\n\n return defineStats({\n async reports() {\n await refreshAnchor();\n const totals = await sql<\n { id: string; entered: number; active: number; completed: number; converted: number }[]\n >`\n select workflow as id,\n count(*)::int as entered,\n count(*) filter (where status = 'running')::int as active,\n count(*) filter (where status in ('completed', 'exited', 'exit_when', 'goal'))::int as completed,\n count(*) filter (where ${converted})::int as converted\n from ${t('instance')} group by workflow`;\n const engagement = await sql<\n { id: string; delivered: number; opened: number; clicked: number }[]\n >`\n select workflow as id,\n count(${reached})::int as delivered,\n count(opened_at) filter (where ${reached} is not null)::int as opened,\n count(clicked_at) filter (where ${reached} is not null)::int as clicked\n from ${t('message')} m group by workflow`;\n const days = lastDays();\n const series = await sql<\n { id: string; day: string; delivered: number; opened: number; clicked: number }[]\n >`\n select workflow as id, to_char(${local('delivered_at')}, 'YYYY-MM-DD') as day,\n count(${reached})::int as delivered,\n count(opened_at) filter (where ${reached} is not null)::int as opened,\n count(clicked_at) filter (where ${reached} is not null)::int as clicked\n from ${t('message')} m where delivered_at is not null\n group by 1, 2`;\n const conversions = await sql<{ id: string; day: string; converted: number }[]>`\n select workflow as id,\n to_char(${onJourneyClock(sql`coalesce(converted_at, finished_at)`)} at time zone ${timeZone}, 'YYYY-MM-DD') as day,\n count(*)::int as converted\n from ${t('instance')} where ${converted} group by 1, 2`;\n const daily = (id: string, rows: { id: string; day: string }[], key: string) =>\n days.map(\n (day) =>\n (\n rows.find((r) => r.id === id && r.day === day) as Record<string, number> | undefined\n )?.[key] ?? 0\n );\n return totals.map((total) => {\n const e = engagement.find((row) => row.id === total.id);\n return {\n id: total.id,\n entered: total.entered,\n active: total.active,\n completed: total.completed,\n converted: total.converted,\n delivered: e?.delivered ?? 0,\n opened: e?.opened ?? 0,\n clicked: e?.clicked ?? 0,\n series: {\n delivered: daily(total.id, series, 'delivered'),\n opened: daily(total.id, series, 'opened'),\n clicked: daily(total.id, series, 'clicked'),\n converted: daily(total.id, conversions, 'converted'),\n },\n };\n });\n },\n\n async nodeStats(workflow) {\n await refreshAnchor();\n const rows = await sql<{ node_id: string; users: number }[]>`\n select node_id, count(*)::int as users from ${t('instance')}\n where workflow = ${workflow} and status = 'running' and node_id is not null\n group by node_id`;\n return Object.fromEntries(rows.map((row) => [row.node_id, row.users]));\n },\n\n async metrics(workflow, query) {\n await refreshAnchor();\n const { from, to } = realRange(query);\n const unit: Granularity = query.granularity;\n const bucket = (column: string) =>\n sql`to_char(date_trunc(${unit}, ${local(column)}), 'YYYY-MM-DD')`;\n const messages = await sql<\n {\n day: string;\n sent: number;\n delivered: number;\n opened: number;\n opened_human: number;\n clicked: number;\n clicked_human: number;\n }[]\n >`\n with m as (\n select * from ${t('message')} m\n where m.workflow = ${workflow} and ${channelFilter(query.channel)}\n ),\n events as (\n select ${bucket('sent_at')} as day, 'sent' as kind, false as human from m\n where sent_at between ${from} and ${to}\n union all select ${bucket('delivered_at')}, 'delivered', false from m\n where ${reached} is not null and delivered_at between ${from} and ${to}\n -- Opens and clicks count against the bucket the message was delivered in (its cohort),\n -- not the day they happened: the rates drawn are opened / delivered, and an open\n -- counted on another day than its delivery reads as 160% on a quiet day\n union all select ${bucket('delivered_at')}, 'opened', human_opened_at is not null from m\n where opened_at is not null and ${reached} is not null and delivered_at between ${from} and ${to}\n union all select ${bucket('delivered_at')}, 'clicked', human_clicked_at is not null from m\n where clicked_at is not null and ${reached} is not null and delivered_at between ${from} and ${to}\n )\n select day,\n count(*) filter (where kind = 'sent')::int as sent,\n count(*) filter (where kind = 'delivered')::int as delivered,\n count(*) filter (where kind = 'opened')::int as opened,\n count(*) filter (where kind = 'opened' and human)::int as opened_human,\n count(*) filter (where kind = 'clicked')::int as clicked,\n count(*) filter (where kind = 'clicked' and human)::int as clicked_human\n from events group by day`;\n // Users by the bucket they entered in, and how many of each cohort reached the goal: the\n // conversion rate is a share of one group of people, so it stays within 100%\n const cohorts = await sql<{ day: string; entered: number; converted: number }[]>`\n select ${bucket('entered_at')} as day, count(*)::int as entered,\n count(*) filter (where ${converted})::int as converted\n from ${t('instance')}\n where workflow = ${workflow} and entered_at between ${from} and ${to}\n group by 1`;\n const buckets = await sql<{ day: string }[]>`\n select to_char(d, 'YYYY-MM-DD') as day\n from generate_series(date_trunc(${unit}, ${query.from}::date), ${query.to}::date, ${`1 ${unit}`}::interval) d`;\n return buckets.map(({ day }) => {\n const m = messages.find((row) => row.day === day);\n const opened = m?.opened ?? 0;\n const clicked = m?.clicked ?? 0;\n const cohort = cohorts.find((row) => row.day === day);\n return {\n date: day,\n sent: m?.sent ?? 0,\n delivered: m?.delivered ?? 0,\n opened,\n openedHuman: m?.opened_human ?? 0,\n openedMachine: opened - (m?.opened_human ?? 0),\n clicked,\n clickedHuman: m?.clicked_human ?? 0,\n clickedMachine: clicked - (m?.clicked_human ?? 0),\n entered: cohort?.entered ?? 0,\n converted: cohort?.converted ?? 0,\n };\n });\n },\n\n async links(workflow, query) {\n await refreshAnchor();\n const { from, to } = realRange(query);\n return sql<{ url: string; clicks: number }[]>`\n select c.url, count(*)::int as clicks\n from ${t('message_click')} c\n join ${t('message')} m on m.id = c.message_id\n where m.workflow = ${workflow} and ${channelFilter(query.channel)}\n and c.clicked_at between ${from} and ${to}\n -- People's clicks only: a scanner follows every link, the footer's included\n and not c.machine\n group by c.url order by clicks desc limit 50`;\n },\n\n async messages(workflow, query) {\n await refreshAnchor();\n const { from, to } = realRange(query);\n return sql<\n {\n nodeId: string;\n template: string;\n channel: MetricChannel;\n sent: number;\n delivered: number;\n opened: number;\n clicked: number;\n unsubscribed: number;\n }[]\n >`\n select node_id as \"nodeId\", template, channel,\n count(*)::int as sent,\n count(${reached})::int as delivered,\n count(opened_at) filter (where ${reached} is not null)::int as opened,\n count(clicked_at) filter (where ${reached} is not null)::int as clicked,\n count(unsubscribed_at)::int as unsubscribed\n from ${t('message')} m\n where m.workflow = ${workflow} and ${channelFilter(query.channel)}\n and m.sent_at between ${from} and ${to}\n group by node_id, template, channel order by node_id, channel`;\n },\n\n async segments() {\n await refreshAnchor();\n const sizes = await sql<{ id: string; size: number }[]>`\n select s.id, count(m.user_id)::int as size\n from ${t('segment')} s\n left join ${t('segment_member')} m on m.segment = s.id\n group by s.id`;\n const days = lastDays();\n // The last snapshot of each journey day\n const snapshots = await sql<{ id: string; day: string; size: number }[]>`\n select distinct on (segment, day) segment as id, day, size from (\n select segment, size, taken_at, to_char(${local('taken_at')}, 'YYYY-MM-DD') as day\n from ${t('segment_snapshot')}\n ) s order by segment, day, taken_at desc`;\n return sizes.map(({ id, size }) => {\n let last = 0;\n const series = days.map((day) => {\n last = snapshots.find((s) => s.id === id && s.day === day)?.size ?? last;\n return last;\n });\n return { id, size, series };\n });\n },\n\n async profiles(segment, { limit, offset }) {\n await refreshAnchor();\n const [count] = await sql<{ total: number }[]>`\n select count(*)::int as total from ${t('segment_member')} where segment = ${segment}`;\n // \"Created\" is the user's first event: the engine knows nothing older about them\n const rows = await sql<\n { id: string; props: Record<string, unknown> | null; created_at: Date | null }[]\n >`\n select m.user_id as id, p.props,\n ${onJourneyClock(sql`first_event.ts`)} as created_at\n from ${t('segment_member')} m\n left join ${t('profile')} p on p.user_id = m.user_id\n left join lateral (\n select min(ts) as ts from ${t('event')} e where e.user_id = m.user_id\n ) first_event on true\n where m.segment = ${segment}\n order by m.ts desc, m.user_id\n limit ${limit} offset ${offset}`;\n return {\n total: count?.total ?? 0,\n profiles: rows.map(({ id, props, created_at }) => {\n const { email, ...properties } = props ?? {};\n const profile: { id: string; email?: string; createdAt?: string } & {\n properties: Record<string, unknown>;\n } = { id, properties };\n if (typeof email === 'string') profile.email = email;\n if (created_at !== null) profile.createdAt = new Date(created_at).toISOString();\n return profile;\n }),\n };\n },\n });\n}\n"],"mappings":"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"}
package/package.json CHANGED
@@ -1,6 +1,96 @@
1
1
  {
2
2
  "name": "@shware/workflow-ui",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "git+https://github.com/ShwareHQ/shware-sdk.git"
7
+ },
8
+ "bin": {
9
+ "workflow-ui": "./dist/cli.mjs"
10
+ },
11
+ "files": [
12
+ "dist",
13
+ "src"
14
+ ],
15
+ "type": "module",
16
+ "exports": {
17
+ ".": {
18
+ "import": {
19
+ "types": "./dist/index.d.mts",
20
+ "default": "./dist/index.mjs"
21
+ }
22
+ },
23
+ "./config": {
24
+ "import": {
25
+ "types": "./dist/config.d.mts",
26
+ "default": "./dist/config.mjs"
27
+ }
28
+ },
29
+ "./postgres": {
30
+ "import": {
31
+ "types": "./dist/postgres.d.mts",
32
+ "default": "./dist/postgres.mjs"
33
+ }
34
+ }
35
+ },
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
39
+ "dependencies": {
40
+ "@floating-ui/react": "^0.27.20",
41
+ "@react-email/render": "^2.1.0",
42
+ "@shware/workflow": "0.1.0",
43
+ "@tailwindcss/vite": "^4.3.3",
44
+ "@tanstack/react-query": "^5.104.0",
45
+ "@tanstack/react-router": "^1.170.39",
46
+ "@vitejs/plugin-react": "^6.1.1",
47
+ "@xyflow/react": "^12.12.0",
48
+ "clsx": "^2.1.1",
49
+ "i18next": "^26.4.2",
50
+ "i18next-browser-languagedetector": "^8.2.1",
51
+ "lucide-react": "^1.48.0",
52
+ "react-i18next": "^17.0.15",
53
+ "sonner": "^2.0.8",
54
+ "tailwind-merge": "^3.7.0",
55
+ "tailwindcss": "^4.3.3",
56
+ "vite": "^8.3.1",
57
+ "vite-plugin-svgr": "^5.2.0"
58
+ },
59
+ "devDependencies": {
60
+ "@fontsource-variable/inter": "^5.3.0",
61
+ "@repo/typescript-config": "0.0.0",
62
+ "@tanstack/react-devtools": "^0.10.13",
63
+ "@tanstack/react-query-devtools": "^5.104.0",
64
+ "@tanstack/react-router-devtools": "^1.167.2",
65
+ "@testing-library/react": "^16.3.3",
66
+ "@testing-library/user-event": "^14.6.7",
67
+ "@types/node": "^26.6.3",
68
+ "@types/react": "^19.3.0",
69
+ "@types/react-dom": "^19.3.0",
70
+ "country-flag-icons": "^1.6.20",
71
+ "jsdom": "^30.1.1",
72
+ "postgres": "^3.4.9",
73
+ "react": "^19.3.0",
74
+ "react-dom": "^19.3.0",
75
+ "typescript": "^7.0.2",
76
+ "vitest": "^5.0.2",
77
+ "zod": "^4.6.5"
78
+ },
79
+ "peerDependencies": {
80
+ "postgres": ">=3.4.0",
81
+ "react": "^19.3.0",
82
+ "react-dom": "^19.3.0"
83
+ },
84
+ "peerDependenciesMeta": {
85
+ "postgres": {
86
+ "optional": true
87
+ }
88
+ },
89
+ "scripts": {
90
+ "dev": "tsc --watch",
91
+ "build": "tsdown",
92
+ "test": "vitest run",
93
+ "check-types": "tsc --noEmit",
94
+ "lint": "oxlint --type-aware src tests --fix"
95
+ }
6
96
  }
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#012169" d="M0 0h513v342H0z"/><path fill="#FFF" d="M440.1 181.1c-.1 39.2-6.4 81.4-57.4 101.5-51.1-20.1-57.3-62.3-57.4-101.5h114.8z"/><path fill="#1B81B6" d="M439.6 197.7c-2.8 34.9-12.4 67.4-57 85-44.4-17.6-54.5-51.2-56.9-84.9"/><path fill="#FFF" d="M437.8 214.1c-3.2 24.3-16.7 53.5-55.1 68.6-38.4-15.1-50.5-42.5-55.1-68.4"/><path fill="#1B81B6" d="M434.2 230.3c-5.7 17.7-19.3 39.4-51.3 52.8-32-12.6-45.2-33.8-51.4-53"/><path fill="#FFF" d="M426.7 246.9c-6.5 11.3-17.7 25.4-44 35.9-27.5-11.5-37.4-25.3-44-36.1"/><path fill="#1B81B6" d="M412.4 265.1c-8.1 7.2-12 11.2-29.6 17.9-20.1-7.9-22.6-11.6-29.2-17.5"/><path fill="#288549" d="M383.3 231.6c-.2-.2-27.9 35.7-27.9 35.7-1.8-1.3-10-9.5-13.3-15l41.3-50.1 40.2 49.7c-3.9 6.5-11.4 13.6-13.2 15M382.6 85.3l-26.5 45h53z"/><g fill="#F0955D"><path d="M275.9 223.6c3.6-26.7 13.5-47.3 22.1-46.2s12.6 23.7 9 50.4-13.5 47.3-22.1 46.2c-8.6-1.2-12.6-23.7-9-50.4zM467.1 177.7c8.6-1.2 18.5 19.5 22.1 46.2s-.4 49.2-9 50.4-18.5-19.6-22.2-46.3c-3.6-26.6.5-49.2 9.1-50.3z"/></g><g fill="#EADFD5"><path d="M296.4 162c2.4-6 7.4-9.7 11-8.2 3.7 1.5 4.7 7.5 2.3 13.5s-7.4 9.7-11 8.2c-3.6-1.5-4.7-7.5-2.3-13.5zM288.4 271.2c.9-6.2 3.1-11.1 4.9-10.8s2.5 5.5 1.6 11.8c-.9 6.2-3.1 11.1-4.9 10.8s-2.5-5.5-1.6-11.8zM299 258.4c1.8-.1 3.6 4.7 3.9 10.8s-.9 11.1-2.7 11.2c-1.8.1-3.6-4.7-3.9-10.8-.3-6.1.9-11.1 2.7-11.2zM309.5 188.4c2.1-.8 6.1 4.2 8.8 11.2 2.8 7 3.3 13.4 1.2 14.2-2.1.8-6.1-4.2-8.8-11.2-2.8-7-3.3-13.4-1.2-14.2zM316 174.3c7-2.8 13.4-3.3 14.2-1.2.8 2.1-4.2 6.1-11.2 8.8-7 2.8-13.4 3.3-14.2 1.2-.9-2.1 4.2-6 11.2-8.8zM457.6 154.1c3.7-1.5 8.6 2.2 11 8.2 2.4 6 1.4 12.1-2.3 13.5-3.7 1.5-8.6-2.2-11-8.2-2.4-6-1.3-12.1 2.3-13.5zM471.8 260.6c1.8-.3 4 4.6 4.9 10.8.9 6.2.2 11.5-1.6 11.8-1.8.3-4-4.6-4.9-10.8-1-6.3-.2-11.5 1.6-11.8zM462.2 269.4c.3-6.1 2.1-10.9 3.9-10.8 1.8.1 3 5.1 2.7 11.2-.3 6.1-2.1 10.9-3.9 10.8-1.8-.1-3-5.1-2.7-11.2zM446.7 199.7c2.8-7 6.7-12.1 8.8-11.2 2.1.8 1.6 7.2-1.2 14.2-2.8 7-6.7 12.1-8.8 11.2s-1.6-7.2 1.2-14.2zM434.9 173.2c.8-2.1 7.2-1.6 14.2 1.2 7 2.8 12.1 6.7 11.2 8.8-.8 2.1-7.2 1.6-14.2-1.2-7-2.7-12.1-6.7-11.2-8.8z"/></g><path fill="#B0C6CC" d="M373.3 130.3 356.1 155l17.8 26.1H396l4.7-25.4-5.4-25.4z"/><path fill="#012169" d="M0 0h256.5v171H0z"/><g fill="#FFF"><path d="M256.5 0v30.6l-45.3 25.2h45.3v59.4h-59.2l59.2 32.9V171h-26.7l-73.7-40.9V171h-55.7v-48.7L12.8 171H0v-30.6l45.3-25.2H0V55.8h59.2L0 22.9V0h26.7l73.7 40.9V0h55.7v48.7L243.7 0z"/><path d="M156.1 115.2 256.5 171v-15.8l-72-40zM100.4 55.8 0 0v15.8l72 40z"/></g><g fill="#D80027"><path d="M144.3 0h-32.1v69.5H0v32h112.2V171h32.1v-69.5h112.2v-32H144.3z"/><path d="M156.1 115.2 256.5 171v-15.8l-72-40zM72 115.2l-72 40V171l100.4-55.8zM100.4 55.8 0 0v15.8l72 40zM184.5 55.8l72-40V0L156.1 55.8z"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#fedd00" d="M0 0h513v342H0z"/><path fill="#10069f" d="M0 0h171v342H0z"/><path fill="#d50032" d="M342 0h171v342H342z"/><path fill="#D80027" d="M198.9 113.6H256v64.8h-57.1z"/><g stroke="#D80027" stroke-width="7"><path d="M267.6 113.6v64.7M284.2 113.6v64.7M300.8 113.6v64.7"/></g><g stroke="#D80027" stroke-width="5"><path d="M247.4 178.4v64.7M234.1 178.4v64.7M220.8 178.5v53.9M207.1 178.5v47.1"/></g><path fill="#FFDA44" d="m199.9 146 27.6-32.4 28.5 32.3-28.1 32.4z"/><path fill="#BC8B00" d="M182.2 95.9v92.2c0 34.3 27.3 54.2 48.6 64.5-.8 1.4 25.1 8.3 25.1 8.3s25.9-6.9 25.1-8.3c21.4-10.3 48.6-30.1 48.6-64.5V95.9H182.2zm129.9 92.2c0 16.9-10 29.4-32.8 43.9-8.6 5.5-17.5 9-23.3 11-5.8-2-14.7-5.5-23.3-11-22.8-14.5-32.8-28-32.8-43.9v-74.5h112.2v74.5z"/><path fill="#D80027" d="M264.4 188.9h29.5v8.6h-29.5zM264.4 206.5h29.5v8.6h-29.5z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#FFF" d="M0 0h513v342H0z"/><path fill="#00843d" d="M0 0h513v114H0z"/><path d="M0 228h513v114H0z"/><path fill="#c8102e" d="M0 0h171v342H0z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#D32011" d="M0 0h513v342H0z"/><path fill="#007A36" d="M342 0h171v342H342z"/><path d="M0 0h171v342H0z"/><path fill="#FFF" d="M256.5 131.3c-17.5 0-31.8 14.3-31.8 31.8v47.7h63.6v-47.7c0-17.7-14.3-31.8-31.8-31.8z"/><path fill="#FFF" d="M256.5 93c-43.1 0-78 34.9-78 78s34.9 77.9 78 77.9 78-34.9 78-78-34.9-77.9-78-77.9zm0 142.4c-35.6 0-64.5-28.9-64.5-64.5s28.9-64.5 64.5-64.5 64.5 29 64.5 64.6c0 35.6-28.9 64.4-64.5 64.4z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path d="M0 0h513v342H0z"/><path fill="#0072c6" d="M88.8 136.5c-2.2 12.9-3.4 26.2-3.4 39.8 0 13.6 1.2 27 3.4 39.8L256 228.3l167.2-12.1c2.2-12.9 3.4-26.2 3.4-39.8s-1.2-27-3.4-39.8"/><path fill="#FFF" d="M423.2 219H88.8c15.8 69.8 84.7 122.3 167.2 122.3S407.4 288.8 423.2 219z"/><path fill="#FFDA44" d="M365.9 136.5H146.1l44.9-21.1-23.9-43.5 48.8 9.4L222 32l34 36.2L290 32l6.1 49.3 48.8-9.4-23.9 43.5z"/><g fill="#ce1126"><path d="M256.5 342 0 0v342z"/><path d="M513 342V0L256 342z"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#012169" d="M0 0h513v342H0z"/><path fill="#FFF" d="M454.8 265.38c7.94-10.93 13.24-24.27 13.24-40.42V104.89a59.754 59.754 0 0 1-36.02 12.01c-19.64 0-37.07-9.43-48.03-24.01-10.95 14.58-28.39 24.01-48.03 24.01-13.52 0-25.99-4.47-36.02-12v120.06c0 16.16 5.3 29.5 13.24 40.42H454.8z"/><path fill="#9cf" d="M310.23 260.98C332.65 296.96 384 309 384 309s51.35-12.04 73.77-48.02H310.23z"/><g fill="#f90"><path d="M396.66 172.21c.32 1.42 8.72 10.17 17.56 20.15 1.39 1.57-8.74 12.63-6.91 12.59 4.75-.12 19.27-17.26 19.34 6.65.05 15.94-30 27.51-30 27.51h17.47l.65 14.96s4.97-13.34 7.59-16.57c8.1-9.97 20.18-30.07 34.59-27.1 14.41 2.97-13.66-13.92-13.66-13.92s-5.2-15.19-16.63-16.97c-10.06-1.57-14.29-2.51-26.64-7.3-1.68-.65-3.88-2.32-3.36 0z"/><path d="M359.69 198.69c1.07-.99 4.46-12.63 8.69-25.28.67-1.99 15.31 1.27 14.35-.3-2.47-4.06-24.58-8.08-3.9-20.08 13.79-8 38.82 12.27 38.82 12.27l-8.72-15.14 12.64-8.03s-14.05 2.35-18.14 1.69c-12.68-2.04-36.13-2.48-40.75-16.45-4.62-13.97-5.25 18.79-5.25 18.79s-10.56 12.08-6.4 22.88c3.66 9.5 4.96 13.64 6.97 26.73.29 1.79-.06 4.53 1.69 2.92z"/><path d="M395.67 219.87c-1.39-.43-13.16 2.49-26.22 5.18-2.06.42-6.59-13.88-7.47-12.26-2.27 4.17 5.36 25.31-15.41 13.45-13.84-7.91-8.89-39.73-8.89-39.73l-8.71 15.14-13.29-6.9s9.09 10.96 10.57 14.84c4.6 11.99 16 32.49 6.24 43.49-9.76 11.01 18.88-4.9 18.88-4.9s15.76 3.07 23-5.96c6.38-7.94 9.3-11.14 19.61-19.45 1.43-1.12 3.97-2.19 1.69-2.9z"/></g><path fill="#012169" d="M0 0h256.5v171H0z"/><g fill="#FFF"><path d="M256.5 0v30.6l-45.3 25.2h45.3v59.4h-59.2l59.2 32.9V171h-26.7l-73.7-40.9V171h-55.7v-48.7L12.8 171H0v-30.6l45.3-25.2H0V55.8h59.2L0 22.9V0h26.7l73.7 40.9V0h55.7v48.7L243.7 0z"/><path d="M156.1 115.2 256.5 171v-15.8l-72-40zM100.4 55.8 0 0v15.8l72 40z"/></g><g fill="#D80027"><path d="M144.3 0h-32.1v69.5H0v32h112.2V171h32.1v-69.5h112.2v-32H144.3z"/><path d="M156.1 115.2 256.5 171v-15.8l-72-40zM72 115.2l-72 40V171l100.4-55.8zM100.4 55.8 0 0v15.8l72 40zM184.5 55.8l72-40V0L156.1 55.8z"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 90 60"><path fill="#ED2024" d="M0 0h90v60H0z"/><path fill="#212121" d="M32.5 12.2v16l7.1 2.5-5 4.9 2.4 3 5.3-5.5 1.2 2.3-3 4.9 3.6 5.6-1.8 2.6 2.8 3.6 2.7-3.7-1.5-2.6 3-5.8-2.7-4.6 1.2-2.3 5.2 5.5 2.5-2.9-5.2-5.1 7.2-2.6V12.2l-5.2 1.9-.1 3.8-3.3.3v-2.6l1.7-2.3 5.6-2.2-2.3-.4 1.4-1.2.9.4-.8-1.4L54 9l-1-1.1L47.5 9l1.4 1.1-3.8 4.9-3.8-4.8 1.3-1.1-5-1.2L36.2 9l-1.5-.4-.8 1.4.9-.6 1.6 1.1-2.3.5 5.5 2 1.6 2.3v2.9l-3.3-.3v-3.6z"/><g fill="#212121"><path d="M26.2 25h6.4v2.5h-6.4zM26.2 20.9h6.4v2.7h-6.4zM26.2 16.7h6.4v2.6h-6.4zM26.2 12.7h6.4v2.5h-6.4z"/></g><g fill="#212121"><path d="M57.4 25h6.4v2.5h-6.4zM57.4 20.9h6.4v2.7h-6.4zM57.4 16.7h6.4v2.6h-6.4zM57.4 12.7h6.4v2.5h-6.4z"/></g><path fill="#212121" d="M53.4 36.1h6.4V38h-6.4zM30.2 36.1h6.4V38h-6.4z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#0052B4" d="M0 0h513v342H0z"/><path fill="#D80027" d="M0 0h513v114H0z"/><path fill="#FF9811" d="M0 228h513v114H0z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path d="M0 171h513v171H0z"/><path fill="#D80027" d="M0 0h513v171H0z"/><g fill="#FFDA44"><path d="m332.7 135.6 17.5-8.6-7.4-19-18.7 6.2zM287.1 79.6l5.5-18.8-19.1-7.2-8 18zM316.5 102.8l12.2-15.3-14.9-13.9-14.2 13.6zM335.9 171.7l19.5-.8v-21.3l-22.9.2zM323.3 209.8l18.8 5.5 7.3-19-18-8zM294.3 242.2l14.9 12.7 14.4-14.4-13.1-14.7zM247.3 94.5l9.8 19.9 21.9 3.3-15.9 15.5 3.6 21.9-19.6-10.4-19.7 10.2 3.8-21.9-15.8-15.5 22-3.1z"/><path d="m250.8 61.3-2.7 18.3c43.1 3.2 77 39.2 77 83.1 0 46-37.3 82.9-83.4 83.4-29.2.3-51.3-14.8-67-33.7l-13.9 12.3c15 19 40.8 39.9 80.9 39.9 56.3 0 101.9-45.6 101.9-101.9.1-53.2-40.7-96.9-92.8-101.4z"/><path fill="#000" d="m291.9 223.4-11.8 14s51.9 38.9 53.6 40.4c1.7 1.5 5.2 2 9.1-2.7 3.7-4.5 2.8-8.1.9-9.7-2-1.5-51.8-42-51.8-42z"/><path d="M206.1 157.2c-7.7 10.3-7.5 23.1 2.8 30.9 0 0 135.2 101.5 136.9 103 1.7 1.5 5.2 2 9.1-2.7 3.7-4.5 2.8-8.1.9-9.7-1.9-1.5-149.7-121.5-149.7-121.5zM253.8 256.3l7.3 18.2 19.5-6-4.8-19.1zM213.4 252.6l-2 19.5 20.1 3.6 4.5-19.1zM177.7 231.4 167.4 248l16.4 12.1 12.5-15.2z"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 744 496"><path fill="#3A7DCE" d="M0 0h744v496H0V0z"/><path fill="#fff" d="m120 125 90 63 54-14 23-81 61-36 92 14 105 55 6 90 34 12v92l-65 115-78 24-72-17 18-30-8-32-10 9-162-25-49-85 20-46-49-62z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#FFF" d="M0 0h512v342H0z"/><path fill="#338AF3" d="M0 0h512v114H0zM0 228h512v114H0z"/><circle fill="#FFDA44" stroke="#d6ab00" stroke-width="5" cx="256.5" cy="171" r="40"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#10338c" d="M0 0h513v342H0z"/><path fill="#D80027" d="M513 33 95.3 171 513 310.76V342L0 171 513 0z"/><path fill="#FFF" d="M513 287.18v24.58L81.72 171 513 30v24.16"/><path fill="#A2001D" d="m476.98 140.21-21.89 10.68-3.18-15.32 31.19-29.77s-9.42-40.65-13.75-44.98l-112.32 55.82-6.84 36.76-31.9 28.59-.4 34.2 34.29-22.76 67.23-2.66-1.51 38.11h22.23l11.9-44.64 31.55-24.61-6.6-19.42z"/><path fill="#EFC100" stroke="#231F20" stroke-miterlimit="10" d="m317.89 238.41-22.24-11.11 22.24-11.11h144.46v22.22z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#FFF" d="M0 114h513v114H0z"/><path fill="#D80027" d="M0 0h513v114H0zM0 228h513v114H0z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#00008b" d="M0 0h513v342H0z"/><g fill="#FFF"><path d="m188 212.6 11 22.9 24.7-5.7-11 22.8 19.9 15.8-24.8 5.6.1 25.4-19.9-15.9-19.8 15.9.1-25.4-24.8-5.6 19.9-15.8-11.1-22.8 24.8 5.7zM385.9 241.1l5.2 10.9 11.8-2.7-5.3 10.9 9.5 7.5-11.8 2.6v12.2l-9.4-7.6-9.5 7.6.1-12.2-11.8-2.6 9.5-7.5-5.3-10.9 11.8 2.7zM337.3 125.1l5.2 10.9 11.8-2.7-5.3 10.9 9.5 7.5-11.8 2.7v12.1l-9.4-7.6-9.5 7.6.1-12.1-11.9-2.7 9.5-7.5-5.3-10.9L332 136zM385.9 58.9l5.2 10.9 11.8-2.7-5.3 10.9 9.5 7.5-11.8 2.7v12.1l-9.4-7.6-9.5 7.6.1-12.1-11.8-2.7 9.5-7.5-5.3-10.9 11.8 2.7zM428.4 108.6l5.2 10.9 11.8-2.7-5.3 10.9 9.5 7.5-11.8 2.6V150l-9.4-7.6-9.5 7.6v-12.2l-11.8-2.6 9.5-7.5-5.3-10.9 11.8 2.7zM398 166.5l4.1 12.7h13.3l-10.8 7.8 4.2 12.7-10.8-7.9-10.8 7.9 4.1-12.7-10.7-7.8h13.3z"/></g><path fill="#00008b" d="M0 0h256.5v171H0z"/><g fill="#FFF"><path d="M256.5 0v30.6l-45.3 25.2h45.3v59.4h-59.2l59.2 32.9V171h-26.7l-73.7-40.9V171h-55.7v-48.7L12.8 171H0v-30.6l45.3-25.2H0V55.8h59.2L0 22.9V0h26.7l73.7 40.9V0h55.7v48.7L243.7 0z"/><path d="M156.1 115.2 256.5 171v-15.8l-72-40zM100.4 55.8 0 0v15.8l72 40z"/></g><g fill="red"><path d="M144.3 0h-32.1v69.5H0v32h112.2V171h32.1v-69.5h112.2v-32H144.3z"/><path d="M156.1 115.2 256.5 171v-15.8l-72-40zM72 115.2l-72 40V171l100.4-55.8zM100.4 55.8 0 0v15.8l72 40zM184.5 55.8l72-40V0L156.1 55.8z"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 363 242"><path fill="#338AF3" d="M0 0h363v242H0z"/><path fill="#FFF" d="M57 96.9 14.7 78.2 57 59.6l18.6-42.2 18.6 42.2 42.3 18.6-42.3 18.7-18.6 42.2z"/><path fill="#f30028" d="m75.6 40.6 11.5 26.1 26.1 11.5-26.1 11.5-11.5 26.1-11.5-26.1L38 78.2l26.1-11.5z"/><g fill="#FFDA44"><path d="M0 152.2h363v15.7H0zM0 183.6h363v15.7H0z"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#0052B4" d="M0 0h513v342H0z"/><path fill="#FFDA44" d="M513 210.9H202.2V342h-79.8V210.9H0V131.1h122.4V0h79.8v131.1H513v61.2z"/><path fill="#D80027" d="M513 149.7v42.6H183.7V342H141V192.3H0v-42.6h141V0h42.7v149.7z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#ef3340" d="M0 0h513v342H0z"/><path fill="#00b5e2" d="M0 0h513v114H0z"/><path fill="#509e2f" d="M0 228h513v114H0z"/><g fill="#FFF"><path d="M265.6 212.6c-23 0-41.6-18.6-41.6-41.6s18.6-41.6 41.6-41.6c7.2 0 13.9 1.8 19.8 5-9.2-9-21.9-14.6-35.8-14.6-28.3 0-51.2 22.9-51.2 51.2s22.9 51.2 51.2 51.2c13.9 0 26.6-5.6 35.8-14.6-5.9 3.2-12.6 5-19.8 5z"/><path d="m297.6 142.2 5.5 15.5 14.9-7.1-7.1 14.9 15.5 5.5-15.5 5.5 7.1 14.9-14.9-7.1-5.5 15.5-5.5-15.5-14.9 7.1 7.1-14.9-15.5-5.5 15.5-5.5-7.1-14.9 14.9 7.1z"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#10338C" d="M0 0h513v342H0z"/><path fill="#F6C500" d="M99.9 0h342v342"/><g fill="#FFF"><path d="M19.9 21.1 40.3 6.2 60.9 21 54 0H26.7z"/><path d="M92.3 25.5 84.4 1.3l-7.8 24.2H51.3l20.5 14.8-7.8 24 20.4-14.8L105 64.3l-7.9-24 20.5-14.9z"/><path d="m136.3 69.2-7.8-24-7.8 24H95.5l20.4 14.9-7.8 24 20.4-14.8 20.6 14.8-7.8-24 20.4-14.9z"/><path d="m179.4 112.3-7.8-24.1-7.8 24.1h-25.3l20.5 14.9-7.8 24 20.4-14.8 20.6 14.8-7.9-24 20.5-15z"/><path d="m222.5 155.3-7.8-24-7.8 24h-25.4l20.6 15-7.8 24 20.4-14.9 20.4 14.9-7.8-24 20.6-15z"/><path d="m265.6 198.4-7.8-24-7.8 24h-25.4l20.6 14.9-7.8 24.1 20.4-14.9 20.4 14.9-7.8-24.2 20.5-14.8z"/><path d="m308.7 241.5-7.9-24-7.8 24h-25.3l20.5 14.8-7.9 24.2 20.6-14.9 20.4 14.8-7.8-24.1 20.5-14.8z"/><path d="m351.7 284.6-7.8-24.2-7.8 24.2h-25.3l20.4 14.8-7.8 24.1 20.5-14.9 20.5 14.9-7.8-24.1 20.4-14.8z"/><path d="m387 303.5-7.9 24.1-25.3.1 19.8 14.3h26.6l19.9-14.4h-25.3z"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#ffc726" d="M0 0h513v342H0z"/><g fill="#00267f"><path d="M0 0h171v342H0zM342 0h171v342H342z"/></g><path d="m325.74 101.02-31.97 12.4c-.68 1.35-5.79 7.54-8.18 53.06h-17.05v-60.42L256 78.68l-12.54 27v60.8H226.4c-2.39-45.53-7.8-52.48-8.47-53.84l-31.68-11.63c.15.31 15.4 31.34 15.4 78.01v12.54h41.81v71.07h25.08v-71.07h41.81v-12.54c0-24.13 4.17-44.02 7.68-56.46 3.82-13.57 7.7-21.49 7.74-21.57l-.03.03z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 513 342"><path fill="#2d6e41" d="M0 85.331h513v342H0z"/><circle fill="#F40B32" cx="218.902" cy="256.5" r="115"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#fdda25" d="M0 0h513v342H0z"/><path d="M0 0h171v342H0z"/><path fill="#ef3340" d="M342 0h171v342H342z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#3d944f" d="M0 0h513v342H0z"/><path fill="#ef2b2d" d="M0 0h513v171H0z"/><path fill="#FFDA44" d="m256 102.6 16.9 52h54.7l-44.2 32.2 16.8 52-44.2-32.1-44.2 32.1 16.8-52-44.2-32.2h54.7z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#00966e" d="M0 0h513v342H0z"/><path fill="#FFF" d="M0 0h513v114H0z"/><path fill="#d62612" d="M0 228h513v114H0z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#D80027" d="M0 0h513v342H0z"/><path fill="#FFF" d="m222.8 34.3-85.2 34.2 85.2 34.1-85.2 34.1 85.2 34.1-85.2 34.1 85.2 34.1-85.2 34.1 85.2 34.1-85.2 34.8H0V0h137.6z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#D80027" d="M0 0h513v342H0z"/><g fill="#47a644"><path d="M215.9 170.7 0 314.6V26.8zM513 26.8v287.8L297.1 170.7z"/></g><path fill="#0052B4" d="M513 26.8 296.1 170.7 513 314.6V342h-41.1L256 197.4 40.1 342H0v-27.4l215.9-143.9L0 26.8V0h40.1L256 143.9 471.9 0H513z"/><path fill="#FFF" d="M513 26.8 297.1 170.7 513 314.6V342h-40L256 197.4 39 342H0v-27.4l215.9-143.9L0 26.8V0h40.1L256 143.9 471.9 0H513z"/><circle fill="#FFF" cx="251.6" cy="170.7" r="100.2"/><g fill="#D80027" stroke="#47a644" stroke-width="3"><path d="m251.4 103.6 7.4 12.9h14.8l-7.4 12.8 7.4 12.8h-14.8l-7.4 12.9-7.4-12.9h-14.8l7.4-12.8-7.4-12.8H244zM290.2 170.3l7.4 12.9h14.8L305 196l7.4 12.8h-14.8l-7.4 12.9-7.4-12.9h-14.9l7.4-12.8-7.4-12.8h14.9zM213 170.3l7.4 12.9h14.9l-7.4 12.8 7.4 12.8h-14.9l-7.4 12.9-7.4-12.9h-14.8l7.4-12.8-7.4-12.8h14.8z"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#008751" d="M0 0h513v342H0z"/><path fill="#fcd116" d="M197 0h316v171H197z"/><path fill="#e8112d" d="M197 171h316v171H197z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#FFF" d="M0 0h513v342H0z"/><g fill="#E6BC00"><path d="M157.3 199.8s-9 43.9-19.3 40.4c-10.6-3.5-17.5-18.8-17.5-18.8L106 242.6s38.2 8.5 41 5.5c1.2-1.1 8.2-15.1 10.3-26.1v-22.2zm-56.1 60.5s-2.5 20.2-1.1 22.7c1.2 2.3 39.5 11.3 39.5 11.3s-25 16.5-29.7 20.5l-18.1-29.9-.7-24.6h10.1zM112.5 94.6s39.7 41.6 40.4 45.5c.7 3.7-4.2 3.2-4.2 3.2s-44.8-37.5-49.9-41.1c-5.4-3.5 13.7-7.6 13.7-7.6zM359.2 201.3s9 42.4 19.2 38.9c10.6-3.5 17.5-18.8 17.5-18.8l14.5 21.2s-37 8.5-39.8 5.5c-1.2-1.1-9.3-13.8-11.5-24.7l.1-22.1zm56 59s2.5 20.2 1.1 22.7c-1.2 2.3-39.5 11.3-39.5 11.3s25 16.5 29.7 20.5l18.1-29.9.7-24.6h-10.1zM403.9 94.6s-39.6 41.6-40.4 45.5c-.7 3.7 4.2 3.2 4.2 3.2s44.8-37.5 49.9-41.1c5.2-3.5-13.7-7.6-13.7-7.6z"/></g><g fill="#ADADAD"><path d="M99.4 104.7s17-.7 16.6-11.5c-.4-10.6-11.2-14.9-19.1-12.4-8 2.3-23 13.4-13.6 35.1 9.4 21.4 23.4 29.4 26.2 47.8 0 0-5.5 9.9-19.1.4-16.9-11.8-6.2-38.2-10.4-45-4.2-7.1-41-38.9-41-38.9s-30.2 39.4-18 74.9c17 49.2 51.7 32 64.6 36.8 0 0-42.1 62-49.6 67.1 0 0 24.1 8.3 47.8-18.8 0 0 5.8 9.7 7.1 20.2h10.3c4.8-26.2 51.5-64.3 49.9-82.3-1.8-21.3-49.2-49.5-51.7-73.4zM365.1 178c-1.6 18.1 45.1 56.1 49.9 82.3h10.3c1.2-10.4 7.1-20.2 7.1-20.2 23.7 27.1 47.8 18.8 47.8 18.8-7.4-5.1-49.6-67.1-49.6-67.1 12.9-4.8 47.7 12.4 64.6-36.8 12.2-35.6-18-74.9-18-74.9s-36.7 31.8-41 38.9c-4.2 6.7 6.5 33.2-10.4 45-13.7 9.5-19.1-.4-19.1-.4 2.8-18.4 16.8-26.4 26.2-47.8 9.4-21.6-5.7-32.8-13.6-35.1-8-2.5-18.8 1.8-19.1 12.4-.4 10.8 16.6 11.5 16.6 11.5-2.5 24-49.9 52.2-51.7 73.4z"/></g><path fill="#125ECC" d="M157.3 87.1h201.8v145.5c0 16.1-9.7 21.4-21.9 31.8l-45.9 39.4c-18.2 15.6-47.9 15.6-66.1 0l-46-39.4c-12.1-10.4-21.9-15.7-21.9-31.8V87.1z"/><path fill="#FFE600" d="M200.6 147.7c-8 0-14.4-6.4-14.4-14.4s6.4-14.4 14.4-14.4 14.4 6.4 14.4 14.4-6.5 14.4-14.4 14.4zm57.6-3c-8 0-14.4-6.4-14.4-14.4s6.4-14.4 14.4-14.4 14.4 6.4 14.4 14.4-6.4 14.4-14.4 14.4zm57.7 3c-8 0-14.4-6.4-14.4-14.4s6.5-14.4 14.4-14.4 14.4 6.4 14.4 14.4-6.5 14.4-14.4 14.4zM215 274.4c-8 0-14.4-6.5-14.4-14.4 0-8 6.4-14.4 14.4-14.4s14.4 6.4 14.4 14.4-6.5 14.4-14.4 14.4zm43.2 14.5c-8 0-14.4-6.5-14.4-14.4s6.4-14.4 14.4-14.4 14.4 6.5 14.4 14.4-6.4 14.4-14.4 14.4zm43.2-14.5c-8 0-14.4-6.5-14.4-14.4 0-8 6.5-14.4 14.4-14.4s14.4 6.4 14.4 14.4c.1 8-6.4 14.4-14.4 14.4z"/><path fill="#D60537" d="M157.3 175.4h201.8V233H157.3v-57.6z"/><path fill="#EACE00" d="M142.9 43.8s57.6-14.4 115.3-14.4 115.3 14.4 115.3 14.4l-14.4 57.7s-50.5-14.4-100.9-14.4-100.9 14.4-100.9 14.4l-14.4-57.7z"/><path fill="#7A6920" d="M258.2 72.7c-8 0-14.4-6.4-14.4-14.4s6.4-14.4 14.4-14.4 14.4 6.5 14.4 14.4-6.4 14.4-14.4 14.4zm57.7 5c-8 0-14.4-6.4-14.4-14.4s6.5-14.4 14.4-14.4 14.4 6.5 14.4 14.4-6.5 14.4-14.4 14.4zm-115.3 0c-8 0-14.4-6.4-14.4-14.4s6.4-14.4 14.4-14.4S215 55.3 215 63.2s-6.5 14.5-14.4 14.5z"/><circle fill="#FFF" cx="258.2" cy="204.2" r="16.9"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#c8102e" d="M0 0h513v342H0z"/><path fill="#fff" stroke="#000" stroke-width="2" d="M303.9 94.94v99.69c0 59.81 79.75 99.69 79.75 99.69s79.75-39.88 79.75-99.69V94.94H303.9z"/><path fill="#2F8F22" d="M436.37 254.44H330.93c23.13 25.08 52.72 39.88 52.72 39.88s29.59-14.8 52.72-39.88z"/><circle fill="#65B5D2" cx="383.65" cy="214.56" r="39.88"/><circle fill="#c8102e" cx="343.77" cy="194.63" r="19.94"/><circle fill="#c8102e" cx="423.52" cy="194.63" r="19.94"/><circle fill="#c8102e" cx="383.65" cy="154.75" r="19.94"/><path fill="#012169" d="M0 0h256.5v171H0z"/><g fill="#FFF"><path d="M256.5 0v30.6l-45.3 25.2h45.3v59.4h-59.2l59.2 32.9V171h-26.7l-73.7-40.9V171h-55.7v-48.7L12.8 171H0v-30.6l45.3-25.2H0V55.8h59.2L0 22.9V0h26.7l73.7 40.9V0h55.7v48.7L243.7 0z"/><path d="M156.1 115.2 256.5 171v-15.8l-72-40zM100.4 55.8 0 0v15.8l72 40z"/></g><g fill="#c8102e"><path d="M144.3 0h-32.1v69.5H0v32h112.2V171h32.1v-69.5h112.2v-32H144.3z"/><path d="M156.1 115.2 256.5 171v-15.8l-72-40zM72 115.2l-72 40V171l100.4-55.8zM100.4 55.8 0 0v15.8l72 40zM184.5 55.8l72-40V0L156.1 55.8z"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#FFDA44" d="M0 0h513v342H0z"/><path d="m0 193.74 513 127.19V214.26L0 97.08z"/><path fill="#FFF" d="M513 234.26v-86.67L0 20.41v86.67"/><g fill="#D80027" stroke="#231F20" stroke-width="3" stroke-miterlimit="10"><path d="M306.4 134.01a50.28 50.28 0 0 1 6.07 24.02c0 21.55-13.51 39.94-32.52 47.19v-59.51c5.7-1.19 10-6.37 10-12.59 6.9 0 12.5-5.75 12.5-12.85h-.42c6.9 0 12.91-5.75 12.91-12.85h-34.99V76.58l-14.99-27.71-15 27.71v30.84h-34.99c0 7.1 6.01 12.85 12.91 12.85h-.42c0 7.1 5.6 12.85 12.5 12.85 0 6.22 4.29 11.4 9.99 12.59v61.37c-22.09-5.39-38.48-25.3-38.48-49.05 0-8.7 2.2-16.88 6.07-24.02-10.96 11.21-17.72 26.53-17.72 43.44 0 34.32 27.82 62.15 62.15 62.15s62.15-27.83 62.15-62.15c0-16.91-6.77-32.24-17.72-43.44z"/><path d="M198.46 226.81s20.69 27.71 66.5 27.71 66.5-27.71 66.5-27.71l13.47 28.37s-21.03 27.71-79.97 27.71-79.97-27.71-79.97-27.71l13.47-28.37zM129.24 133.18h20.88l24.93 27.26v73.45h-26.28v-68.37zM400 133.18h-20.88l-24.93 27.26v73.45h26.27v-68.37z"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#d52b1e" d="M0 0h513v114H0z"/><path fill="#f9e300" d="M0 114h513v114H0z"/><path fill="#007934" d="M0 228h513v114H0z"/></svg>