@shware/workflow-ui 0.0.0-stage → 0.0.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.
- package/LICENSE +21 -0
- package/README.md +180 -2
- package/dist/assets/iphone-17-pro-DzaacWSl.png +0 -0
- package/dist/assets/pixel-10-pro-back-7MDj1_lz.webp +0 -0
- package/dist/assets/pixel-10-pro-mask-Bi1deQ9Y.webp +0 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +673 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/config.d.mts +247 -0
- package/dist/config.d.mts.map +1 -0
- package/dist/config.mjs +27 -0
- package/dist/config.mjs.map +1 -0
- package/dist/index.d.mts +451 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +2722 -0
- package/dist/index.mjs.map +1 -0
- package/dist/postgres.d.mts +34 -0
- package/dist/postgres.d.mts.map +1 -0
- package/dist/postgres.mjs +313 -0
- package/dist/postgres.mjs.map +1 -0
- package/package.json +93 -3
- package/src/app/assets/devices/iphone-17-pro.png +0 -0
- package/src/app/assets/devices/pixel-10-pro-back.webp +0 -0
- package/src/app/assets/devices/pixel-10-pro-mask.webp +0 -0
- package/src/app/assets/flags/AC.svg +1 -0
- package/src/app/assets/flags/AD.svg +1 -0
- package/src/app/assets/flags/AE.svg +1 -0
- package/src/app/assets/flags/AF.svg +1 -0
- package/src/app/assets/flags/AG.svg +1 -0
- package/src/app/assets/flags/AI.svg +1 -0
- package/src/app/assets/flags/AL.svg +1 -0
- package/src/app/assets/flags/AM.svg +1 -0
- package/src/app/assets/flags/AO.svg +1 -0
- package/src/app/assets/flags/AQ.svg +1 -0
- package/src/app/assets/flags/AR.svg +1 -0
- package/src/app/assets/flags/AS.svg +1 -0
- package/src/app/assets/flags/AT.svg +1 -0
- package/src/app/assets/flags/AU.svg +1 -0
- package/src/app/assets/flags/AW.svg +1 -0
- package/src/app/assets/flags/AX.svg +1 -0
- package/src/app/assets/flags/AZ.svg +1 -0
- package/src/app/assets/flags/BA.svg +1 -0
- package/src/app/assets/flags/BB.svg +1 -0
- package/src/app/assets/flags/BD.svg +1 -0
- package/src/app/assets/flags/BE.svg +1 -0
- package/src/app/assets/flags/BF.svg +1 -0
- package/src/app/assets/flags/BG.svg +1 -0
- package/src/app/assets/flags/BH.svg +1 -0
- package/src/app/assets/flags/BI.svg +1 -0
- package/src/app/assets/flags/BJ.svg +1 -0
- package/src/app/assets/flags/BL.svg +1 -0
- package/src/app/assets/flags/BM.svg +1 -0
- package/src/app/assets/flags/BN.svg +1 -0
- package/src/app/assets/flags/BO.svg +1 -0
- package/src/app/assets/flags/BQ-BO.svg +1 -0
- package/src/app/assets/flags/BQ-SA.svg +1 -0
- package/src/app/assets/flags/BQ-SE.svg +1 -0
- package/src/app/assets/flags/BQ.svg +1 -0
- package/src/app/assets/flags/BR.svg +1 -0
- package/src/app/assets/flags/BS.svg +1 -0
- package/src/app/assets/flags/BT.svg +1 -0
- package/src/app/assets/flags/BV.svg +1 -0
- package/src/app/assets/flags/BW.svg +1 -0
- package/src/app/assets/flags/BY.svg +1 -0
- package/src/app/assets/flags/BZ.svg +1 -0
- package/src/app/assets/flags/CA.svg +1 -0
- package/src/app/assets/flags/CC.svg +1 -0
- package/src/app/assets/flags/CD.svg +1 -0
- package/src/app/assets/flags/CF.svg +1 -0
- package/src/app/assets/flags/CG.svg +1 -0
- package/src/app/assets/flags/CH.svg +1 -0
- package/src/app/assets/flags/CI.svg +1 -0
- package/src/app/assets/flags/CK.svg +1 -0
- package/src/app/assets/flags/CL.svg +1 -0
- package/src/app/assets/flags/CM.svg +1 -0
- package/src/app/assets/flags/CN.svg +1 -0
- package/src/app/assets/flags/CO.svg +1 -0
- package/src/app/assets/flags/CR.svg +1 -0
- package/src/app/assets/flags/CU.svg +1 -0
- package/src/app/assets/flags/CV.svg +1 -0
- package/src/app/assets/flags/CW.svg +1 -0
- package/src/app/assets/flags/CX.svg +1 -0
- package/src/app/assets/flags/CY.svg +1 -0
- package/src/app/assets/flags/CZ.svg +1 -0
- package/src/app/assets/flags/DE.svg +1 -0
- package/src/app/assets/flags/DJ.svg +1 -0
- package/src/app/assets/flags/DK.svg +1 -0
- package/src/app/assets/flags/DM.svg +1 -0
- package/src/app/assets/flags/DO.svg +1 -0
- package/src/app/assets/flags/DZ.svg +1 -0
- package/src/app/assets/flags/EC.svg +1 -0
- package/src/app/assets/flags/EE.svg +1 -0
- package/src/app/assets/flags/EG.svg +1 -0
- package/src/app/assets/flags/EH.svg +1 -0
- package/src/app/assets/flags/ER.svg +1 -0
- package/src/app/assets/flags/ES-CT.svg +1 -0
- package/src/app/assets/flags/ES.svg +1 -0
- package/src/app/assets/flags/ET.svg +1 -0
- package/src/app/assets/flags/EU.svg +1 -0
- package/src/app/assets/flags/FI.svg +1 -0
- package/src/app/assets/flags/FJ.svg +1 -0
- package/src/app/assets/flags/FK.svg +1 -0
- package/src/app/assets/flags/FM.svg +1 -0
- package/src/app/assets/flags/FO.svg +1 -0
- package/src/app/assets/flags/FR.svg +1 -0
- package/src/app/assets/flags/GA.svg +1 -0
- package/src/app/assets/flags/GB-ENG.svg +1 -0
- package/src/app/assets/flags/GB-NIR.svg +1 -0
- package/src/app/assets/flags/GB-SCT.svg +1 -0
- package/src/app/assets/flags/GB-WLS.svg +1 -0
- package/src/app/assets/flags/GB.svg +1 -0
- package/src/app/assets/flags/GD.svg +1 -0
- package/src/app/assets/flags/GE.svg +1 -0
- package/src/app/assets/flags/GF.svg +1 -0
- package/src/app/assets/flags/GG.svg +1 -0
- package/src/app/assets/flags/GH.svg +1 -0
- package/src/app/assets/flags/GI.svg +1 -0
- package/src/app/assets/flags/GL.svg +1 -0
- package/src/app/assets/flags/GM.svg +1 -0
- package/src/app/assets/flags/GN.svg +1 -0
- package/src/app/assets/flags/GP.svg +1 -0
- package/src/app/assets/flags/GQ.svg +1 -0
- package/src/app/assets/flags/GR.svg +1 -0
- package/src/app/assets/flags/GS.svg +1 -0
- package/src/app/assets/flags/GT.svg +1 -0
- package/src/app/assets/flags/GU.svg +1 -0
- package/src/app/assets/flags/GW.svg +1 -0
- package/src/app/assets/flags/GY.svg +1 -0
- package/src/app/assets/flags/HK.svg +1 -0
- package/src/app/assets/flags/HM.svg +1 -0
- package/src/app/assets/flags/HN.svg +1 -0
- package/src/app/assets/flags/HR.svg +1 -0
- package/src/app/assets/flags/HT.svg +1 -0
- package/src/app/assets/flags/HU.svg +1 -0
- package/src/app/assets/flags/IC.svg +1 -0
- package/src/app/assets/flags/ID.svg +1 -0
- package/src/app/assets/flags/IE.svg +1 -0
- package/src/app/assets/flags/IL.svg +1 -0
- package/src/app/assets/flags/IM.svg +1 -0
- package/src/app/assets/flags/IN.svg +1 -0
- package/src/app/assets/flags/IO.svg +1 -0
- package/src/app/assets/flags/IQ.svg +1 -0
- package/src/app/assets/flags/IR.svg +1 -0
- package/src/app/assets/flags/IS.svg +1 -0
- package/src/app/assets/flags/IT.svg +1 -0
- package/src/app/assets/flags/JE.svg +1 -0
- package/src/app/assets/flags/JM.svg +1 -0
- package/src/app/assets/flags/JO.svg +1 -0
- package/src/app/assets/flags/JP.svg +1 -0
- package/src/app/assets/flags/KE.svg +1 -0
- package/src/app/assets/flags/KG.svg +1 -0
- package/src/app/assets/flags/KH.svg +1 -0
- package/src/app/assets/flags/KI.svg +1 -0
- package/src/app/assets/flags/KM.svg +1 -0
- package/src/app/assets/flags/KN.svg +1 -0
- package/src/app/assets/flags/KP.svg +1 -0
- package/src/app/assets/flags/KR.svg +1 -0
- package/src/app/assets/flags/KW.svg +1 -0
- package/src/app/assets/flags/KY.svg +1 -0
- package/src/app/assets/flags/KZ.svg +1 -0
- package/src/app/assets/flags/LA.svg +1 -0
- package/src/app/assets/flags/LB.svg +1 -0
- package/src/app/assets/flags/LC.svg +1 -0
- package/src/app/assets/flags/LI.svg +1 -0
- package/src/app/assets/flags/LK.svg +1 -0
- package/src/app/assets/flags/LR.svg +1 -0
- package/src/app/assets/flags/LS.svg +1 -0
- package/src/app/assets/flags/LT.svg +1 -0
- package/src/app/assets/flags/LU.svg +1 -0
- package/src/app/assets/flags/LV.svg +1 -0
- package/src/app/assets/flags/LY.svg +1 -0
- package/src/app/assets/flags/MA.svg +1 -0
- package/src/app/assets/flags/MC.svg +1 -0
- package/src/app/assets/flags/MD.svg +1 -0
- package/src/app/assets/flags/ME.svg +1 -0
- package/src/app/assets/flags/MF.svg +1 -0
- package/src/app/assets/flags/MG.svg +1 -0
- package/src/app/assets/flags/MH.svg +1 -0
- package/src/app/assets/flags/MK.svg +1 -0
- package/src/app/assets/flags/ML.svg +1 -0
- package/src/app/assets/flags/MM.svg +1 -0
- package/src/app/assets/flags/MN.svg +1 -0
- package/src/app/assets/flags/MO.svg +1 -0
- package/src/app/assets/flags/MP.svg +1 -0
- package/src/app/assets/flags/MQ.svg +1 -0
- package/src/app/assets/flags/MR.svg +1 -0
- package/src/app/assets/flags/MS.svg +1 -0
- package/src/app/assets/flags/MT.svg +1 -0
- package/src/app/assets/flags/MU.svg +1 -0
- package/src/app/assets/flags/MV.svg +1 -0
- package/src/app/assets/flags/MW.svg +1 -0
- package/src/app/assets/flags/MX.svg +1 -0
- package/src/app/assets/flags/MY.svg +1 -0
- package/src/app/assets/flags/MZ.svg +1 -0
- package/src/app/assets/flags/NA.svg +1 -0
- package/src/app/assets/flags/NC.svg +1 -0
- package/src/app/assets/flags/NE.svg +1 -0
- package/src/app/assets/flags/NF.svg +1 -0
- package/src/app/assets/flags/NG.svg +1 -0
- package/src/app/assets/flags/NI.svg +1 -0
- package/src/app/assets/flags/NL.svg +1 -0
- package/src/app/assets/flags/NO.svg +1 -0
- package/src/app/assets/flags/NP.svg +1 -0
- package/src/app/assets/flags/NR.svg +1 -0
- package/src/app/assets/flags/NU.svg +1 -0
- package/src/app/assets/flags/NZ.svg +1 -0
- package/src/app/assets/flags/OM.svg +1 -0
- package/src/app/assets/flags/PA.svg +1 -0
- package/src/app/assets/flags/PE.svg +1 -0
- package/src/app/assets/flags/PF.svg +1 -0
- package/src/app/assets/flags/PG.svg +1 -0
- package/src/app/assets/flags/PH.svg +1 -0
- package/src/app/assets/flags/PK.svg +1 -0
- package/src/app/assets/flags/PL.svg +1 -0
- package/src/app/assets/flags/PM.svg +1 -0
- package/src/app/assets/flags/PN.svg +1 -0
- package/src/app/assets/flags/PR.svg +1 -0
- package/src/app/assets/flags/PS.svg +1 -0
- package/src/app/assets/flags/PT.svg +1 -0
- package/src/app/assets/flags/PW.svg +1 -0
- package/src/app/assets/flags/PY.svg +1 -0
- package/src/app/assets/flags/QA.svg +1 -0
- package/src/app/assets/flags/RE.svg +1 -0
- package/src/app/assets/flags/README.md +6 -0
- package/src/app/assets/flags/RO.svg +1 -0
- package/src/app/assets/flags/RS.svg +1 -0
- package/src/app/assets/flags/RU.svg +1 -0
- package/src/app/assets/flags/RW.svg +1 -0
- package/src/app/assets/flags/SA.svg +1 -0
- package/src/app/assets/flags/SB.svg +1 -0
- package/src/app/assets/flags/SC.svg +1 -0
- package/src/app/assets/flags/SD.svg +1 -0
- package/src/app/assets/flags/SE.svg +1 -0
- package/src/app/assets/flags/SG.svg +1 -0
- package/src/app/assets/flags/SH.svg +1 -0
- package/src/app/assets/flags/SI.svg +1 -0
- package/src/app/assets/flags/SJ.svg +1 -0
- package/src/app/assets/flags/SK.svg +1 -0
- package/src/app/assets/flags/SL.svg +1 -0
- package/src/app/assets/flags/SM.svg +1 -0
- package/src/app/assets/flags/SN.svg +1 -0
- package/src/app/assets/flags/SO.svg +1 -0
- package/src/app/assets/flags/SR.svg +1 -0
- package/src/app/assets/flags/SS.svg +1 -0
- package/src/app/assets/flags/ST.svg +1 -0
- package/src/app/assets/flags/SV.svg +1 -0
- package/src/app/assets/flags/SX.svg +1 -0
- package/src/app/assets/flags/SY.svg +1 -0
- package/src/app/assets/flags/SZ.svg +1 -0
- package/src/app/assets/flags/TA.svg +1 -0
- package/src/app/assets/flags/TC.svg +1 -0
- package/src/app/assets/flags/TD.svg +1 -0
- package/src/app/assets/flags/TF.svg +1 -0
- package/src/app/assets/flags/TG.svg +1 -0
- package/src/app/assets/flags/TH.svg +1 -0
- package/src/app/assets/flags/TJ.svg +1 -0
- package/src/app/assets/flags/TK.svg +1 -0
- package/src/app/assets/flags/TL.svg +1 -0
- package/src/app/assets/flags/TM.svg +1 -0
- package/src/app/assets/flags/TN.svg +1 -0
- package/src/app/assets/flags/TO.svg +1 -0
- package/src/app/assets/flags/TR.svg +1 -0
- package/src/app/assets/flags/TT.svg +1 -0
- package/src/app/assets/flags/TV.svg +1 -0
- package/src/app/assets/flags/TW.svg +1 -0
- package/src/app/assets/flags/TZ.svg +1 -0
- package/src/app/assets/flags/UA.svg +1 -0
- package/src/app/assets/flags/UG.svg +1 -0
- package/src/app/assets/flags/UM.svg +1 -0
- package/src/app/assets/flags/US.svg +1 -0
- package/src/app/assets/flags/UY.svg +1 -0
- package/src/app/assets/flags/UZ.svg +1 -0
- package/src/app/assets/flags/VA.svg +1 -0
- package/src/app/assets/flags/VC.svg +1 -0
- package/src/app/assets/flags/VE.svg +1 -0
- package/src/app/assets/flags/VG.svg +1 -0
- package/src/app/assets/flags/VI.svg +1 -0
- package/src/app/assets/flags/VN.svg +1 -0
- package/src/app/assets/flags/VU.svg +1 -0
- package/src/app/assets/flags/WF.svg +1 -0
- package/src/app/assets/flags/WS.svg +1 -0
- package/src/app/assets/flags/XA.svg +1 -0
- package/src/app/assets/flags/XC.svg +1 -0
- package/src/app/assets/flags/XK.svg +1 -0
- package/src/app/assets/flags/XO.svg +1 -0
- package/src/app/assets/flags/YE.svg +1 -0
- package/src/app/assets/flags/YT.svg +1 -0
- package/src/app/assets/flags/ZA.svg +1 -0
- package/src/app/assets/flags/ZM.svg +1 -0
- package/src/app/assets/flags/ZW.svg +1 -0
- package/src/app/email-preview.ts +46 -0
- package/src/app/index.css +203 -0
- package/src/app/index.html +12 -0
- package/src/app/integrations/i18n/react-i18next.d.ts +11 -0
- package/src/app/integrations/i18n/root-provider.tsx +62 -0
- package/src/app/integrations/tanstack-query/devtools.tsx +6 -0
- package/src/app/integrations/tanstack-query/root-provider.tsx +37 -0
- package/src/app/integrations/theme/root-provider.tsx +75 -0
- package/src/app/integrations/toast/toast-provider.tsx +46 -0
- package/src/app/locales/en-US/common.ts +268 -0
- package/src/app/locales/zh-CN/common.ts +263 -0
- package/src/app/main.tsx +40 -0
- package/src/app/page-chrome.tsx +79 -0
- package/src/app/router.tsx +40 -0
- package/src/app/routes/__root.tsx +293 -0
- package/src/app/routes/emails.tsx +199 -0
- package/src/app/routes/home.tsx +87 -0
- package/src/app/routes/index.ts +19 -0
- package/src/app/routes/metrics.tsx +541 -0
- package/src/app/routes/segment-overview.tsx +211 -0
- package/src/app/routes/segments.tsx +236 -0
- package/src/app/routes/settings.tsx +90 -0
- package/src/app/routes/workflows.tsx +348 -0
- package/src/app/studio.ts +16 -0
- package/src/app/svg.d.ts +17 -0
- package/src/app/virtual-config.d.ts +6 -0
- package/src/cli.ts +110 -0
- package/src/components/avatar.tsx +57 -0
- package/src/components/breadcrumb.tsx +49 -0
- package/src/components/button/index.tsx +86 -0
- package/src/components/channel-icon.ts +39 -0
- package/src/components/chat-markup.tsx +109 -0
- package/src/components/corner-shape.ts +13 -0
- package/src/components/date-range.tsx +181 -0
- package/src/components/discord-preview.tsx +165 -0
- package/src/components/dropdown/index.tsx +172 -0
- package/src/components/email-defaults.tsx +40 -0
- package/src/components/email-list.tsx +149 -0
- package/src/components/email-thumbnail.tsx +123 -0
- package/src/components/flag.tsx +40 -0
- package/src/components/input/index.tsx +40 -0
- package/src/components/input/search-input.tsx +24 -0
- package/src/components/layout.ts +403 -0
- package/src/components/menu/index.tsx +118 -0
- package/src/components/metric-card.tsx +321 -0
- package/src/components/modal/index.tsx +70 -0
- package/src/components/nav-drawer.tsx +84 -0
- package/src/components/node-inspector.tsx +242 -0
- package/src/components/profile-drawer.tsx +331 -0
- package/src/components/push-preview.tsx +470 -0
- package/src/components/push-thumbnail.tsx +78 -0
- package/src/components/segment-list.tsx +184 -0
- package/src/components/select/index.tsx +70 -0
- package/src/components/series-chart.tsx +120 -0
- package/src/components/slack-preview.tsx +223 -0
- package/src/components/sparkline.tsx +58 -0
- package/src/components/tabs/index.tsx +45 -0
- package/src/components/template-refs.ts +110 -0
- package/src/components/templates-page.tsx +601 -0
- package/src/components/textarea/index.tsx +37 -0
- package/src/components/thumbnail-window.tsx +65 -0
- package/src/components/workflow-canvas.tsx +503 -0
- package/src/components/workflow-list.tsx +231 -0
- package/src/config.ts +288 -0
- package/src/generate.ts +56 -0
- package/src/index.ts +35 -0
- package/src/postgres.ts +415 -0
- package/src/server/project.ts +290 -0
- package/src/server.ts +500 -0
- package/src/utils/cn.ts +6 -0
- package/src/utils/label.ts +12 -0
- package/src/utils/lookup.ts +11 -0
- package/src/utils/template-content.ts +213 -0
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
nav: {
|
|
3
|
+
home: 'Home',
|
|
4
|
+
workflows: 'Workflows',
|
|
5
|
+
segments: 'Segments',
|
|
6
|
+
templates: 'Templates',
|
|
7
|
+
settings: 'Settings',
|
|
8
|
+
collapse: 'Collapse',
|
|
9
|
+
expand: 'Expand sidebar',
|
|
10
|
+
menu: 'Menu',
|
|
11
|
+
},
|
|
12
|
+
common: {
|
|
13
|
+
name: 'Name',
|
|
14
|
+
addDescription: 'Add a description…',
|
|
15
|
+
untitled: 'Untitled',
|
|
16
|
+
none: 'None',
|
|
17
|
+
loading: 'Loading…',
|
|
18
|
+
notConfigured: 'Not configured',
|
|
19
|
+
back: 'Back',
|
|
20
|
+
close: 'Close',
|
|
21
|
+
previous: 'Previous',
|
|
22
|
+
next: 'Next',
|
|
23
|
+
},
|
|
24
|
+
status: {
|
|
25
|
+
running: 'Running',
|
|
26
|
+
draft: 'Draft',
|
|
27
|
+
},
|
|
28
|
+
home: {
|
|
29
|
+
title: 'Overview',
|
|
30
|
+
subtitle: 'Totals across every workflow in this project.',
|
|
31
|
+
workflows: 'Workflows',
|
|
32
|
+
templates: 'Templates',
|
|
33
|
+
segments: 'Segments',
|
|
34
|
+
entered: 'Entered',
|
|
35
|
+
converted: 'Converted',
|
|
36
|
+
conversionRate: 'Conversion rate',
|
|
37
|
+
missingTemplates: '{{count}} referenced without content',
|
|
38
|
+
},
|
|
39
|
+
workflows: {
|
|
40
|
+
title: 'Workflows',
|
|
41
|
+
searchPlaceholder: 'Search workflows…',
|
|
42
|
+
noMatches: 'No workflows match “{{query}}”',
|
|
43
|
+
empty: 'No workflows exported from workflow.config.ts',
|
|
44
|
+
notFound: 'No workflow with id {{id}}',
|
|
45
|
+
messages: 'messages',
|
|
46
|
+
delays: 'delays',
|
|
47
|
+
tabs: { overview: 'Overview', canvas: 'Workflow' },
|
|
48
|
+
columns: {
|
|
49
|
+
delivered: 'Delivered',
|
|
50
|
+
opened: 'Opened',
|
|
51
|
+
clicked: 'Clicked',
|
|
52
|
+
converted: 'Converted',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
metrics: {
|
|
56
|
+
title: 'Metrics',
|
|
57
|
+
noSource: 'No metrics source configured',
|
|
58
|
+
noSourceHint:
|
|
59
|
+
'Add a stats.metrics function to workflow.config.ts to chart the funnel over time.',
|
|
60
|
+
noData: 'No data for this workflow in this range.',
|
|
61
|
+
sent: 'Sent',
|
|
62
|
+
delivered: 'Delivered',
|
|
63
|
+
opened: 'Opened',
|
|
64
|
+
clicked: 'Clicked',
|
|
65
|
+
converted: 'Converted',
|
|
66
|
+
series: {
|
|
67
|
+
openedHuman: 'Human Opened',
|
|
68
|
+
openedMachine: 'Machine Opened',
|
|
69
|
+
clickedHuman: 'Human Clicked',
|
|
70
|
+
clickedMachine: 'Machine Clicked',
|
|
71
|
+
},
|
|
72
|
+
vsPrevious: '{{value}} vs. previous period',
|
|
73
|
+
granularity: {
|
|
74
|
+
day: 'Daily',
|
|
75
|
+
week: 'Weekly',
|
|
76
|
+
month: 'Monthly',
|
|
77
|
+
},
|
|
78
|
+
range: {
|
|
79
|
+
weekOf: 'Week of {{date}}',
|
|
80
|
+
lastDays: 'Last {{count}} days',
|
|
81
|
+
from: 'From',
|
|
82
|
+
to: 'To',
|
|
83
|
+
separator: 'to',
|
|
84
|
+
},
|
|
85
|
+
channel: {
|
|
86
|
+
all: 'All channels',
|
|
87
|
+
email: 'Email',
|
|
88
|
+
push_ios: 'iOS notification',
|
|
89
|
+
push_android: 'Android notification',
|
|
90
|
+
push_web: 'Web notification',
|
|
91
|
+
slack: 'Slack message',
|
|
92
|
+
discord: 'Discord message',
|
|
93
|
+
sms: 'SMS',
|
|
94
|
+
webhook: 'Webhook',
|
|
95
|
+
},
|
|
96
|
+
links: {
|
|
97
|
+
title: 'Links',
|
|
98
|
+
topClicked: 'Top clicked links (entire workflow)',
|
|
99
|
+
totalClicks: 'Total clicks',
|
|
100
|
+
empty: 'No link clicks in this range.',
|
|
101
|
+
},
|
|
102
|
+
messages: {
|
|
103
|
+
title: 'Message Metrics',
|
|
104
|
+
actionName: 'Action name',
|
|
105
|
+
allMessages: 'All messages',
|
|
106
|
+
sent: 'Sent',
|
|
107
|
+
delivered: 'Delivered',
|
|
108
|
+
opened: 'Opened',
|
|
109
|
+
clicked: 'Clicked',
|
|
110
|
+
unsubscribed: 'Unsubscribed',
|
|
111
|
+
empty: 'No messages sent in this range.',
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
segments: {
|
|
115
|
+
title: 'Segments',
|
|
116
|
+
searchPlaceholder: 'Search segments…',
|
|
117
|
+
noMatches: 'No segments match “{{query}}”',
|
|
118
|
+
empty: 'No segments referenced by these workflows.',
|
|
119
|
+
usedBy: 'Used by',
|
|
120
|
+
unused: 'Not used by any workflow',
|
|
121
|
+
size: 'Size',
|
|
122
|
+
overTime: 'Over time',
|
|
123
|
+
change: 'Change',
|
|
124
|
+
profiles: 'Profiles',
|
|
125
|
+
members: 'Members',
|
|
126
|
+
noProfiles: 'No profiles returned for this segment.',
|
|
127
|
+
noData: 'Not enough history to chart yet.',
|
|
128
|
+
noSource: 'No stats source configured',
|
|
129
|
+
noSourceHint:
|
|
130
|
+
'Add stats.segments and stats.profiles to workflow.config.ts to see who is in this segment.',
|
|
131
|
+
tabs: { overview: 'Overview' },
|
|
132
|
+
notDefined: 'Referenced but not exported from the workflows directory',
|
|
133
|
+
definition: 'Definition',
|
|
134
|
+
},
|
|
135
|
+
profiles: {
|
|
136
|
+
email: 'Email',
|
|
137
|
+
id: 'ID',
|
|
138
|
+
utmSource: 'UTM Source',
|
|
139
|
+
createdAt: 'Created',
|
|
140
|
+
noProperties: 'No properties on this profile.',
|
|
141
|
+
copy: 'Copy',
|
|
142
|
+
sections: {
|
|
143
|
+
user: 'User Data',
|
|
144
|
+
source: 'Source Info',
|
|
145
|
+
device: 'Device Info',
|
|
146
|
+
utm: 'UTM parameters',
|
|
147
|
+
others: 'Others',
|
|
148
|
+
},
|
|
149
|
+
fields: {
|
|
150
|
+
name: 'Name',
|
|
151
|
+
company: 'Company',
|
|
152
|
+
country: 'Country',
|
|
153
|
+
region: 'Region',
|
|
154
|
+
city: 'City',
|
|
155
|
+
platform: 'Platform',
|
|
156
|
+
language: 'Language',
|
|
157
|
+
time_zone: 'Time Zone',
|
|
158
|
+
release: 'Release',
|
|
159
|
+
device: 'Device',
|
|
160
|
+
os: 'Operating System',
|
|
161
|
+
browser: 'Browser',
|
|
162
|
+
screen_resolution: 'Screen Resolution',
|
|
163
|
+
device_pixel_ratio: 'Device Pixel Ratio',
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
emails: {
|
|
167
|
+
title: 'Templates',
|
|
168
|
+
searchPlaceholder: 'Search templates…',
|
|
169
|
+
noMatches: 'No templates match “{{query}}”',
|
|
170
|
+
ready: 'Ready',
|
|
171
|
+
tabs: { preview: 'Preview' },
|
|
172
|
+
previewLight: 'Light mode',
|
|
173
|
+
previewDark: 'Dark mode',
|
|
174
|
+
previewDesktop: 'Desktop',
|
|
175
|
+
previewMobile: 'Mobile',
|
|
176
|
+
zoomIn: 'Zoom in',
|
|
177
|
+
zoomOut: 'Zoom out',
|
|
178
|
+
zoomReset: 'Reset zoom',
|
|
179
|
+
empty: 'No templates registered or referenced.',
|
|
180
|
+
notFound: 'No template {{key}} here.',
|
|
181
|
+
noContent: 'no content',
|
|
182
|
+
name: 'Name',
|
|
183
|
+
description: 'Description',
|
|
184
|
+
subject: 'Subject',
|
|
185
|
+
from: 'From',
|
|
186
|
+
replyTo: 'Reply to',
|
|
187
|
+
sentBy: 'Sent by',
|
|
188
|
+
rendering: 'Rendering…',
|
|
189
|
+
contentTitle: 'Title',
|
|
190
|
+
contentBody: 'Body',
|
|
191
|
+
contentImage: 'Image',
|
|
192
|
+
previewProps: 'Preview props',
|
|
193
|
+
previewPropsHint:
|
|
194
|
+
'In memory only, never saved. Checked against the template’s props schema on every change.',
|
|
195
|
+
previewPropsReset: 'Reset',
|
|
196
|
+
previewPropsNotObject: 'Expected a JSON object',
|
|
197
|
+
failure: {
|
|
198
|
+
json: 'Not valid JSON',
|
|
199
|
+
props: 'The props do not match the template’s schema',
|
|
200
|
+
content: 'content() did not return a valid notification',
|
|
201
|
+
render: 'The template failed to render',
|
|
202
|
+
},
|
|
203
|
+
notRegistered: 'No component registered',
|
|
204
|
+
pushNotRegistered: 'No push content registered',
|
|
205
|
+
notRegisteredHint:
|
|
206
|
+
'A workflow references {{key}}, but no email template is registered for it in the email registry.',
|
|
207
|
+
pushNotRegisteredHint:
|
|
208
|
+
'A workflow references {{key}}, but no push template is registered for it in the push registry.',
|
|
209
|
+
chatNotRegisteredHint:
|
|
210
|
+
'A workflow references {{key}}, but the {{channel}} registry has no template for it.',
|
|
211
|
+
chatNow: 'Today at 9:41 AM',
|
|
212
|
+
slackBlockUnsupported: 'A {{type}} block (not drawn in the preview)',
|
|
213
|
+
},
|
|
214
|
+
settings: {
|
|
215
|
+
emailDefaults: 'Email envelope',
|
|
216
|
+
emailDefaultsHint:
|
|
217
|
+
'Every email is sent with these — emails.from / replyTo in workflow.config.ts.',
|
|
218
|
+
title: 'Settings',
|
|
219
|
+
language: 'Language',
|
|
220
|
+
languageHint: 'Applies to the studio interface only.',
|
|
221
|
+
theme: 'Theme',
|
|
222
|
+
themeHint: 'System follows your OS setting.',
|
|
223
|
+
themes: { light: 'Light', dark: 'Dark', system: 'System' },
|
|
224
|
+
project: 'Project',
|
|
225
|
+
statsSource: 'Stats source',
|
|
226
|
+
connected: 'Connected',
|
|
227
|
+
},
|
|
228
|
+
project: {
|
|
229
|
+
error: {
|
|
230
|
+
load: 'The project failed to load',
|
|
231
|
+
compile: 'The project does not compile',
|
|
232
|
+
},
|
|
233
|
+
errorHint: 'Fix workflow.config.ts or the module named above; the studio refreshes on save.',
|
|
234
|
+
},
|
|
235
|
+
inspector: {
|
|
236
|
+
close: 'Close',
|
|
237
|
+
id: 'Node id',
|
|
238
|
+
label: 'Label',
|
|
239
|
+
source: 'Source',
|
|
240
|
+
field: {
|
|
241
|
+
duration: 'Wait for',
|
|
242
|
+
min: 'At least',
|
|
243
|
+
max: 'At most',
|
|
244
|
+
timeout: 'Give up after',
|
|
245
|
+
from: 'From',
|
|
246
|
+
to: 'To',
|
|
247
|
+
tz: 'Timezone',
|
|
248
|
+
reason: 'Reason',
|
|
249
|
+
value: 'Value',
|
|
250
|
+
within: 'Within',
|
|
251
|
+
count: 'At least',
|
|
252
|
+
},
|
|
253
|
+
openTemplate: 'Open template',
|
|
254
|
+
type: {
|
|
255
|
+
message: 'Message',
|
|
256
|
+
delay: 'Time delay',
|
|
257
|
+
random_delay: 'Random delay',
|
|
258
|
+
time_window: 'Time window',
|
|
259
|
+
wait_until: 'Wait until',
|
|
260
|
+
branch: 'Branch',
|
|
261
|
+
filter: 'Filter',
|
|
262
|
+
cohort: 'Random cohort',
|
|
263
|
+
exit: 'Exit',
|
|
264
|
+
send_event: 'Send event',
|
|
265
|
+
action: 'Custom action',
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
};
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
nav: {
|
|
3
|
+
home: '概览',
|
|
4
|
+
workflows: '流程',
|
|
5
|
+
segments: '用户分群',
|
|
6
|
+
templates: '模板',
|
|
7
|
+
settings: '设置',
|
|
8
|
+
collapse: '收起',
|
|
9
|
+
expand: '展开侧边栏',
|
|
10
|
+
menu: '菜单',
|
|
11
|
+
},
|
|
12
|
+
common: {
|
|
13
|
+
name: '名称',
|
|
14
|
+
addDescription: '添加说明…',
|
|
15
|
+
untitled: '未命名',
|
|
16
|
+
none: '无',
|
|
17
|
+
loading: '加载中…',
|
|
18
|
+
notConfigured: '未配置',
|
|
19
|
+
back: '返回',
|
|
20
|
+
close: '关闭',
|
|
21
|
+
previous: '上一页',
|
|
22
|
+
next: '下一页',
|
|
23
|
+
},
|
|
24
|
+
status: {
|
|
25
|
+
running: '运行中',
|
|
26
|
+
draft: '草稿',
|
|
27
|
+
},
|
|
28
|
+
home: {
|
|
29
|
+
title: '概览',
|
|
30
|
+
subtitle: '本项目所有流程的汇总数据。',
|
|
31
|
+
workflows: '流程',
|
|
32
|
+
templates: '模板',
|
|
33
|
+
segments: '用户分群',
|
|
34
|
+
entered: '进入人数',
|
|
35
|
+
converted: '转化人数',
|
|
36
|
+
conversionRate: '转化率',
|
|
37
|
+
missingTemplates: '{{count}} 个被引用但没有内容',
|
|
38
|
+
},
|
|
39
|
+
workflows: {
|
|
40
|
+
title: '流程',
|
|
41
|
+
searchPlaceholder: '搜索流程…',
|
|
42
|
+
noMatches: '没有匹配“{{query}}”的流程',
|
|
43
|
+
empty: 'workflow.config.ts 中没有导出任何流程',
|
|
44
|
+
notFound: '没有 id 为 {{id}} 的流程',
|
|
45
|
+
messages: '条消息',
|
|
46
|
+
delays: '个等待',
|
|
47
|
+
tabs: { overview: '概览', canvas: '流程图' },
|
|
48
|
+
columns: {
|
|
49
|
+
delivered: '已送达',
|
|
50
|
+
opened: '已打开',
|
|
51
|
+
clicked: '已点击',
|
|
52
|
+
converted: '已转化',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
metrics: {
|
|
56
|
+
title: '数据',
|
|
57
|
+
noSource: '未配置数据源',
|
|
58
|
+
noSourceHint: '在 workflow.config.ts 里加上 stats.metrics 即可展示随时间变化的漏斗数据。',
|
|
59
|
+
noData: '该区间内没有数据。',
|
|
60
|
+
sent: '已发送',
|
|
61
|
+
delivered: '已送达',
|
|
62
|
+
opened: '已打开',
|
|
63
|
+
clicked: '已点击',
|
|
64
|
+
converted: '已转化',
|
|
65
|
+
series: {
|
|
66
|
+
openedHuman: '人工打开',
|
|
67
|
+
openedMachine: '机器打开',
|
|
68
|
+
clickedHuman: '人工点击',
|
|
69
|
+
clickedMachine: '机器点击',
|
|
70
|
+
},
|
|
71
|
+
vsPrevious: '{{value}}(较上一周期)',
|
|
72
|
+
granularity: {
|
|
73
|
+
day: '按天',
|
|
74
|
+
week: '按周',
|
|
75
|
+
month: '按月',
|
|
76
|
+
},
|
|
77
|
+
range: {
|
|
78
|
+
weekOf: '{{date}}当周',
|
|
79
|
+
lastDays: '最近 {{count}} 天',
|
|
80
|
+
from: '开始',
|
|
81
|
+
to: '结束',
|
|
82
|
+
separator: '至',
|
|
83
|
+
},
|
|
84
|
+
channel: {
|
|
85
|
+
all: '全部渠道',
|
|
86
|
+
email: '邮件',
|
|
87
|
+
push_ios: 'iOS 推送',
|
|
88
|
+
push_android: 'Android 推送',
|
|
89
|
+
push_web: 'Web 推送',
|
|
90
|
+
slack: 'Slack 消息',
|
|
91
|
+
discord: 'Discord 消息',
|
|
92
|
+
sms: '短信',
|
|
93
|
+
webhook: 'Webhook',
|
|
94
|
+
},
|
|
95
|
+
links: {
|
|
96
|
+
title: '链接',
|
|
97
|
+
topClicked: '点击最多的链接(整个流程)',
|
|
98
|
+
totalClicks: '总点击数',
|
|
99
|
+
empty: '该区间内没有链接点击。',
|
|
100
|
+
},
|
|
101
|
+
messages: {
|
|
102
|
+
title: '消息数据',
|
|
103
|
+
actionName: '消息名称',
|
|
104
|
+
allMessages: '全部消息',
|
|
105
|
+
sent: '已发送',
|
|
106
|
+
delivered: '已送达',
|
|
107
|
+
opened: '已打开',
|
|
108
|
+
clicked: '已点击',
|
|
109
|
+
unsubscribed: '已退订',
|
|
110
|
+
empty: '该区间内没有发送消息。',
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
segments: {
|
|
114
|
+
title: '用户分群',
|
|
115
|
+
searchPlaceholder: '搜索分群…',
|
|
116
|
+
noMatches: '没有匹配“{{query}}”的分群',
|
|
117
|
+
empty: '这些流程没有引用任何分群。',
|
|
118
|
+
usedBy: '被引用于',
|
|
119
|
+
unused: '未被任何流程引用',
|
|
120
|
+
size: '人数',
|
|
121
|
+
overTime: '趋势',
|
|
122
|
+
change: '变化',
|
|
123
|
+
profiles: '用户数',
|
|
124
|
+
members: '成员',
|
|
125
|
+
noProfiles: '该分群没有返回任何用户。',
|
|
126
|
+
noData: '历史数据不足,暂时画不出趋势。',
|
|
127
|
+
noSource: '未配置数据源',
|
|
128
|
+
noSourceHint:
|
|
129
|
+
'在 workflow.config.ts 里加上 stats.segments 和 stats.profiles 即可查看分群成员。',
|
|
130
|
+
tabs: { overview: '概览' },
|
|
131
|
+
notDefined: '被引用但未从 workflows 目录导出',
|
|
132
|
+
definition: '定义',
|
|
133
|
+
},
|
|
134
|
+
profiles: {
|
|
135
|
+
email: '邮箱',
|
|
136
|
+
id: 'ID',
|
|
137
|
+
utmSource: 'UTM 来源',
|
|
138
|
+
createdAt: '创建时间',
|
|
139
|
+
noProperties: '该用户没有任何属性。',
|
|
140
|
+
copy: '复制',
|
|
141
|
+
sections: {
|
|
142
|
+
user: '用户信息',
|
|
143
|
+
source: '来源信息',
|
|
144
|
+
device: '设备信息',
|
|
145
|
+
utm: 'UTM 参数',
|
|
146
|
+
others: '其他',
|
|
147
|
+
},
|
|
148
|
+
fields: {
|
|
149
|
+
name: '姓名',
|
|
150
|
+
company: '公司',
|
|
151
|
+
country: '国家',
|
|
152
|
+
region: '地区',
|
|
153
|
+
city: '城市',
|
|
154
|
+
platform: '平台',
|
|
155
|
+
language: '语言',
|
|
156
|
+
time_zone: '时区',
|
|
157
|
+
release: '版本',
|
|
158
|
+
device: '设备',
|
|
159
|
+
os: '操作系统',
|
|
160
|
+
browser: '浏览器',
|
|
161
|
+
screen_resolution: '屏幕分辨率',
|
|
162
|
+
device_pixel_ratio: '设备像素比',
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
emails: {
|
|
166
|
+
title: '模板',
|
|
167
|
+
searchPlaceholder: '搜索模板…',
|
|
168
|
+
noMatches: '没有匹配“{{query}}”的模板',
|
|
169
|
+
ready: '已就绪',
|
|
170
|
+
tabs: { preview: '预览' },
|
|
171
|
+
previewLight: '浅色模式',
|
|
172
|
+
previewDark: '深色模式',
|
|
173
|
+
previewDesktop: '桌面端',
|
|
174
|
+
previewMobile: '移动端',
|
|
175
|
+
zoomIn: '放大',
|
|
176
|
+
zoomOut: '缩小',
|
|
177
|
+
zoomReset: '重置缩放',
|
|
178
|
+
empty: '没有登记或被引用的模板。',
|
|
179
|
+
notFound: '没有名为 {{key}} 的模板。',
|
|
180
|
+
noContent: '缺内容',
|
|
181
|
+
name: '名称',
|
|
182
|
+
description: '说明',
|
|
183
|
+
subject: '主题',
|
|
184
|
+
from: '发件人',
|
|
185
|
+
replyTo: '回复至',
|
|
186
|
+
sentBy: '发送方',
|
|
187
|
+
rendering: '渲染中…',
|
|
188
|
+
contentTitle: '标题',
|
|
189
|
+
contentBody: '内容',
|
|
190
|
+
contentImage: '图片',
|
|
191
|
+
previewProps: '预览参数',
|
|
192
|
+
previewPropsHint: '只在内存中生效,不会保存。每次修改都会按模板的 props schema 校验。',
|
|
193
|
+
previewPropsReset: '重置',
|
|
194
|
+
previewPropsNotObject: '需要一个 JSON 对象',
|
|
195
|
+
failure: {
|
|
196
|
+
json: '不是有效的 JSON',
|
|
197
|
+
props: '参数不符合模板的 schema',
|
|
198
|
+
content: 'content() 返回的通知无效',
|
|
199
|
+
render: '模板渲染失败',
|
|
200
|
+
},
|
|
201
|
+
notRegistered: '未注册组件',
|
|
202
|
+
pushNotRegistered: '未注册推送内容',
|
|
203
|
+
notRegisteredHint: '有流程引用了 {{key}},但 email 注册表里没有为它注册邮件模板。',
|
|
204
|
+
pushNotRegisteredHint: '有流程引用了 {{key}},但 push 注册表里没有为它注册推送模板。',
|
|
205
|
+
chatNotRegisteredHint: '有流程引用了 {{key}},但 {{channel}} 注册表里没有为它注册模板。',
|
|
206
|
+
chatNow: '今天 上午9:41',
|
|
207
|
+
slackBlockUnsupported: '{{type}} 块(预览中不绘制)',
|
|
208
|
+
},
|
|
209
|
+
settings: {
|
|
210
|
+
emailDefaults: '邮件信封',
|
|
211
|
+
emailDefaultsHint:
|
|
212
|
+
'所有邮件都用这里的发件人发送,对应 workflow.config.ts 的 emails.from / replyTo。',
|
|
213
|
+
title: '设置',
|
|
214
|
+
language: '语言',
|
|
215
|
+
languageHint: '仅影响 studio 界面文案。',
|
|
216
|
+
theme: '主题',
|
|
217
|
+
themeHint: '跟随系统会使用操作系统的深浅色设置。',
|
|
218
|
+
themes: { light: '浅色', dark: '深色', system: '跟随系统' },
|
|
219
|
+
project: '项目',
|
|
220
|
+
statsSource: '数据源',
|
|
221
|
+
connected: '已连接',
|
|
222
|
+
},
|
|
223
|
+
project: {
|
|
224
|
+
error: {
|
|
225
|
+
load: '项目加载失败',
|
|
226
|
+
compile: '项目编译失败',
|
|
227
|
+
},
|
|
228
|
+
errorHint: '修改 workflow.config.ts 或上面提到的模块,保存后 Studio 会自动刷新。',
|
|
229
|
+
},
|
|
230
|
+
inspector: {
|
|
231
|
+
close: '关闭',
|
|
232
|
+
id: '节点 ID',
|
|
233
|
+
label: '名称',
|
|
234
|
+
source: '源码',
|
|
235
|
+
field: {
|
|
236
|
+
duration: '等待时长',
|
|
237
|
+
min: '最短',
|
|
238
|
+
max: '最长',
|
|
239
|
+
timeout: '超时时长',
|
|
240
|
+
from: '开始',
|
|
241
|
+
to: '结束',
|
|
242
|
+
tz: '时区',
|
|
243
|
+
reason: '原因',
|
|
244
|
+
value: '值',
|
|
245
|
+
within: '时间范围',
|
|
246
|
+
count: '至少次数',
|
|
247
|
+
},
|
|
248
|
+
openTemplate: '打开模板',
|
|
249
|
+
type: {
|
|
250
|
+
message: '消息',
|
|
251
|
+
delay: '时间等待',
|
|
252
|
+
random_delay: '随机等待',
|
|
253
|
+
time_window: '时间窗口',
|
|
254
|
+
wait_until: '条件等待',
|
|
255
|
+
branch: '条件分支',
|
|
256
|
+
filter: '过滤',
|
|
257
|
+
cohort: '随机分组',
|
|
258
|
+
exit: '退出',
|
|
259
|
+
send_event: '发送事件',
|
|
260
|
+
action: '自定义动作',
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
};
|
package/src/app/main.tsx
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import './index.css';
|
|
2
|
+
import { RouterProvider } from '@tanstack/react-router';
|
|
3
|
+
import { createRoot } from 'react-dom/client';
|
|
4
|
+
import config from 'virtual:workflow-config';
|
|
5
|
+
import type { ResolvedStudioConfig } from '../config';
|
|
6
|
+
import { applyStoredTheme } from './integrations/theme/root-provider';
|
|
7
|
+
import { getRouter } from './router';
|
|
8
|
+
|
|
9
|
+
const rootElement = document.getElementById('root');
|
|
10
|
+
if (!rootElement) throw new Error('missing #root element');
|
|
11
|
+
|
|
12
|
+
/* Names the tab after the project; the sidebar always reads "Workflow Studio". */
|
|
13
|
+
if (config.title !== undefined) document.title = config.title;
|
|
14
|
+
|
|
15
|
+
/* Before the first paint, so a dark-mode user never sees a white flash. */
|
|
16
|
+
applyStoredTheme();
|
|
17
|
+
|
|
18
|
+
const router = getRouter(config);
|
|
19
|
+
createRoot(rootElement).render(<RouterProvider router={router} />);
|
|
20
|
+
|
|
21
|
+
/*
|
|
22
|
+
* HMR boundary for the project's source. The studio is read-only: you edit in
|
|
23
|
+
* your editor, and every project source the studio shows is imported by
|
|
24
|
+
* `virtual:workflow-config` — without an accept the update would bubble past
|
|
25
|
+
* the entry and Vite would full-reload the page on each save. Accepting the config module here swaps
|
|
26
|
+
* the fresh config into the router's context and invalidates the active
|
|
27
|
+
* matches instead, so views re-render in place. The stats are cached queries,
|
|
28
|
+
* not loader data: they are invalidated too, or a changed workflow.stats.ts
|
|
29
|
+
* (or data source) would keep showing the old numbers.
|
|
30
|
+
*/
|
|
31
|
+
if (import.meta.hot) {
|
|
32
|
+
import.meta.hot.accept('virtual:workflow-config', (mod) => {
|
|
33
|
+
const next = (mod as { default?: ResolvedStudioConfig } | undefined)?.default;
|
|
34
|
+
if (next === undefined) return;
|
|
35
|
+
if (next.title !== undefined) document.title = next.title;
|
|
36
|
+
router.update({ ...router.options, context: { ...router.options.context, config: next } });
|
|
37
|
+
void router.invalidate();
|
|
38
|
+
void router.options.context.queryClient.invalidateQueries();
|
|
39
|
+
});
|
|
40
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { type ReactNode, createContext, useCallback, useContext, useState } from 'react';
|
|
2
|
+
import { createPortal } from 'react-dom';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The unified header's three slots — breadcrumb, centre title, right-hand
|
|
6
|
+
* actions — filled by whichever route is active.
|
|
7
|
+
*
|
|
8
|
+
* Routes portal into DOM slots the root owns rather than lifting state into
|
|
9
|
+
* it. Lifted state looks simpler but loops: a route renders, sets the slot
|
|
10
|
+
* value, the root re-renders, the route (a child of its Outlet) re-renders,
|
|
11
|
+
* its `actions` node has a new identity, it sets again. Portals sidestep all
|
|
12
|
+
* of that — React context, the router included, flows through them, and the
|
|
13
|
+
* root never re-renders on a route's account.
|
|
14
|
+
*
|
|
15
|
+
* The slot elements land in state via callback refs, so the very first paint
|
|
16
|
+
* has none and portals skip; the root's commit fills them one tick later.
|
|
17
|
+
*
|
|
18
|
+
* Every callback here is memoised, and that is load-bearing, not tidiness. A
|
|
19
|
+
* callback ref with a new identity makes React call the old one with `null`
|
|
20
|
+
* and the new one with the element on every commit; that null→element flip is
|
|
21
|
+
* a real state change each time, so the header re-renders, mints another
|
|
22
|
+
* callback, and the tree never settles ("maximum update depth exceeded").
|
|
23
|
+
*/
|
|
24
|
+
export interface ChromeSlots {
|
|
25
|
+
breadcrumb: HTMLElement | null;
|
|
26
|
+
title: HTMLElement | null;
|
|
27
|
+
actions: HTMLElement | null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface ChromeContextValue {
|
|
31
|
+
slots: ChromeSlots;
|
|
32
|
+
register: (slot: keyof ChromeSlots, element: HTMLElement | null) => void;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const ChromeContext = createContext<ChromeContextValue | undefined>(undefined);
|
|
36
|
+
|
|
37
|
+
export function PageChromeProvider({ children }: { children: ReactNode }) {
|
|
38
|
+
const [slots, setSlots] = useState<ChromeSlots>({ breadcrumb: null, title: null, actions: null });
|
|
39
|
+
const register = useCallback(
|
|
40
|
+
(slot: keyof ChromeSlots, element: HTMLElement | null) =>
|
|
41
|
+
setSlots((current) =>
|
|
42
|
+
current[slot] === element ? current : { ...current, [slot]: element }
|
|
43
|
+
),
|
|
44
|
+
[]
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
return <ChromeContext value={{ slots, register }}>{children}</ChromeContext>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** For the root: a callback ref that binds one slot element. */
|
|
51
|
+
export function useChromeSlotRef(slot: keyof ChromeSlots) {
|
|
52
|
+
const context = useContext(ChromeContext);
|
|
53
|
+
if (context === undefined)
|
|
54
|
+
throw new Error('useChromeSlotRef must be used inside PageChromeProvider');
|
|
55
|
+
const { register } = context;
|
|
56
|
+
return useCallback((element: HTMLElement | null) => register(slot, element), [register, slot]);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface PageChromeProps {
|
|
60
|
+
breadcrumb?: ReactNode;
|
|
61
|
+
/** Optional; most views identify themselves by the breadcrumb leaf and leave this empty. */
|
|
62
|
+
title?: ReactNode;
|
|
63
|
+
actions?: ReactNode;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Rendered by a route; declares what the header shows while that route is mounted. */
|
|
67
|
+
export function PageChrome({ breadcrumb, title, actions }: PageChromeProps) {
|
|
68
|
+
const context = useContext(ChromeContext);
|
|
69
|
+
if (context === undefined) throw new Error('PageChrome must be used inside PageChromeProvider');
|
|
70
|
+
const { slots } = context;
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<>
|
|
74
|
+
{breadcrumb !== undefined && slots.breadcrumb && createPortal(breadcrumb, slots.breadcrumb)}
|
|
75
|
+
{title !== undefined && slots.title && createPortal(title, slots.title)}
|
|
76
|
+
{actions !== undefined && slots.actions && createPortal(actions, slots.actions)}
|
|
77
|
+
</>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createRouter } from '@tanstack/react-router';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { ResolvedStudioConfig } from '../config';
|
|
4
|
+
import { I18nProvider, getI18nContext } from './integrations/i18n/root-provider';
|
|
5
|
+
import {
|
|
6
|
+
TanstackQueryProvider,
|
|
7
|
+
getTanstackQueryContext,
|
|
8
|
+
} from './integrations/tanstack-query/root-provider';
|
|
9
|
+
import { ThemeProvider } from './integrations/theme/root-provider';
|
|
10
|
+
import { routeTree } from './routes';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The studio owns the URL, so views are shareable: `/workflows/$name`,
|
|
14
|
+
* `/emails/$key`, `/segments`. The exported components stay router-free, so a
|
|
15
|
+
* host app that embeds them keeps ownership of its own routing.
|
|
16
|
+
*/
|
|
17
|
+
export const getRouter = (config: ResolvedStudioConfig) => {
|
|
18
|
+
const { queryClient } = getTanstackQueryContext();
|
|
19
|
+
const { i18n } = getI18nContext();
|
|
20
|
+
|
|
21
|
+
return createRouter({
|
|
22
|
+
routeTree,
|
|
23
|
+
context: { queryClient, config, i18n },
|
|
24
|
+
defaultPreload: 'intent',
|
|
25
|
+
scrollRestoration: true,
|
|
26
|
+
Wrap: (props: { children: ReactNode }) => (
|
|
27
|
+
<ThemeProvider>
|
|
28
|
+
<I18nProvider i18n={i18n}>
|
|
29
|
+
<TanstackQueryProvider queryClient={queryClient}>{props.children}</TanstackQueryProvider>
|
|
30
|
+
</I18nProvider>
|
|
31
|
+
</ThemeProvider>
|
|
32
|
+
),
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
declare module '@tanstack/react-router' {
|
|
37
|
+
interface Register {
|
|
38
|
+
router: ReturnType<typeof getRouter>;
|
|
39
|
+
}
|
|
40
|
+
}
|