forest-cli 5.24.4 → 5.25.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/services/dumpers/agent-nodejs.d.ts.map +1 -1
  2. package/dist/services/dumpers/agent-nodejs.js +13 -5
  3. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/back.hbs +1 -0
  4. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/back.js +154 -0
  5. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/component.js +154 -0
  6. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/data-map.css +416 -0
  7. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/data-map.hbs +99 -0
  8. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/data-map.js +243 -0
  9. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/demo-guide.css +278 -0
  10. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/demo-guide.hbs +38 -0
  11. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/demo-guide.js +353 -0
  12. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/feature-activity.js +124 -0
  13. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/feature-agent.js +124 -0
  14. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/feature-ai.js +124 -0
  15. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/feature-charts.js +124 -0
  16. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/feature-collections.js +124 -0
  17. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/feature-custom-components.js +124 -0
  18. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/feature-inboxes.js +124 -0
  19. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/feature-roles.js +124 -0
  20. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/feature-segments.js +124 -0
  21. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/feature-smart-actions.js +124 -0
  22. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/feature-workflows.js +124 -0
  23. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/feature-workspaces.js +124 -0
  24. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/feature.css +1109 -0
  25. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/feature.hbs +286 -0
  26. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/go-to.hbs +4 -0
  27. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/go-to.js +217 -0
  28. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/kyc-flow.css +580 -0
  29. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/kyc-flow.hbs +80 -0
  30. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/kyc-flow.js +49 -0
  31. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/run-action.hbs +3 -0
  32. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/run-action.js +96 -0
  33. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/select-first.css +131 -0
  34. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/select-first.hbs +4 -0
  35. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/select-first.js +205 -0
  36. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/senior-guide.hbs +39 -0
  37. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/senior-guide.js +189 -0
  38. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/style.css +372 -0
  39. package/dist/services/dumpers/templates/agent-nodejs/common/components/hub/template.hbs +83 -0
  40. package/dist/services/dumpers/templates/agent-nodejs/common/forest-layout.json +52897 -8498
  41. package/dist/services/dumpers/templates/agent-nodejs/common/workflows/203696b1-e9ca-45f3-9bd3-5bc6fb4fd8c3.bpmn +161 -0
  42. package/dist/services/dumpers/templates/agent-nodejs/common/workflows/2bc0c0ff-486c-44b1-ae31-3de204f7b14f.bpmn +107 -0
  43. package/dist/services/dumpers/templates/agent-nodejs/common/workflows/4b37a274-117f-4c2d-96ad-21d1be4d0bc7.bpmn +159 -0
  44. package/dist/services/dumpers/templates/agent-nodejs/common/workflows/56ff9484-8308-4971-9e02-3de5eea2e240.bpmn +67 -0
  45. package/dist/services/dumpers/templates/agent-nodejs/common/workflows/619e3e88-4a9c-4f02-84fb-732c16f9b5bf.bpmn +43 -0
  46. package/dist/services/dumpers/templates/agent-nodejs/common/workflows/76516b9e-aac0-4f7b-9794-8f86c529531b.bpmn +75 -0
  47. package/dist/services/dumpers/templates/agent-nodejs/common/workflows/86b4fc1e-b10a-4906-9fd1-e601eaad83c0.bpmn +81 -0
  48. package/dist/services/dumpers/templates/agent-nodejs/common/workflows/92b119e5-c908-48d1-9a0d-23173c57bd5b.bpmn +47 -0
  49. package/dist/services/dumpers/templates/agent-nodejs/common/workflows/92c02240-9c8a-49e7-9993-077af3e1ddcc.bpmn +77 -0
  50. package/dist/services/dumpers/templates/agent-nodejs/common/workflows/aac25aee-f626-40a8-9459-d2a933fb8446.bpmn +105 -0
  51. package/dist/services/dumpers/templates/agent-nodejs/common/workflows/b269dbff-5fde-401f-a05b-76a7dac79387.bpmn +75 -0
  52. package/dist/services/dumpers/templates/agent-nodejs/common/workflows/d8b208a9-fc71-4005-acb9-ba5fedd2499f.bpmn +73 -0
  53. package/dist/services/dumpers/templates/agent-nodejs/common/workflows/e3abab67-7bc6-4a44-9848-c7f83a55a56d.bpmn +71 -0
  54. package/dist/services/dumpers/templates/agent-nodejs/javascript/index.hbs +45 -4
  55. package/dist/services/dumpers/templates/agent-nodejs/typescript/Dockerfile.hbs +1 -1
  56. package/dist/services/dumpers/templates/agent-nodejs/typescript/index.hbs +45 -4
  57. package/oclif.manifest.json +136 -136
  58. package/package.json +6 -2
  59. package/dist/services/dumpers/templates/agent-nodejs/common/workflows/30d581e3-294e-4790-b723-0f16509ecae0.bpmn +0 -2
  60. package/dist/services/dumpers/templates/agent-nodejs/common/workflows/52e0acb4-6064-472a-9823-cdfd7fa7a3ab.bpmn +0 -2
  61. package/dist/services/dumpers/templates/agent-nodejs/common/workflows/71f692b4-fe4f-476d-8251-fdc5af1ec51e.bpmn +0 -2
  62. package/dist/services/dumpers/templates/agent-nodejs/common/workflows/9d564d80-19d1-4ce4-bb4b-aaf41e7ef5b6.bpmn +0 -2
  63. package/dist/services/dumpers/templates/agent-nodejs/common/workflows/c8ab4b5d-20df-4d28-9160-0d4376282c90.bpmn +0 -2
  64. package/dist/services/dumpers/templates/agent-nodejs/common/workflows/d0289f67-2c9e-4c69-b1ee-ecbbace841b3.bpmn +0 -2
  65. package/dist/services/dumpers/templates/agent-nodejs/common/workflows/d07aa5ee-9a49-4916-a1b5-1f953bfe9a8e.bpmn +0 -2
  66. package/dist/services/dumpers/templates/agent-nodejs/common/workflows/e25c6237-b882-498b-9655-b16b30131b10.bpmn +0 -2
  67. package/dist/services/dumpers/templates/agent-nodejs/common/workflows/f01b9e61-4156-47b8-b6a1-5c90adbcd2ba.bpmn +0 -2
@@ -0,0 +1,286 @@
1
+ <div class="fx-page">
2
+ <nav class="fx-top">
3
+ <button type="button" class="fx-back" {{on "click" this.openHub}}>← Hub</button>
4
+ <span class="fx-crumb">Forest feature {{this.feature.position}} of {{this.feature.total}}</span>
5
+ </nav>
6
+
7
+ <header class="fx-header">
8
+ <span class="fx-icon" aria-hidden="true">{{this.feature.icon}}</span>
9
+ <div class="fx-header-text">
10
+ <p class="fx-eyebrow">Forest feature</p>
11
+ <h1 class="fx-title">{{this.feature.name}}</h1>
12
+ <p class="fx-promise">{{this.feature.promise}}</p>
13
+ </div>
14
+ </header>
15
+
16
+ <section class="fx-main">
17
+ <div class="fx-what">
18
+ <h2 class="fx-h2">What it is</h2>
19
+ {{#each this.feature.what as |paragraph|}}
20
+ <p class="fx-p">{{paragraph}}</p>
21
+ {{/each}}
22
+ </div>
23
+
24
+ <figure class="fx-art">
25
+ {{#if this.art.collections}}
26
+ <div class="fx-ill fx-ill-two">
27
+ <div class="fx-mock">
28
+ <div class="fx-mock-bar"><b>Customers</b><span class="fx-mock-search">Search…</span></div>
29
+ <div class="fx-row fx-row-head"><span>Name</span><span>Type</span><span>Risk</span></div>
30
+ <div class="fx-row"><span>Camille Laurent</span><span>Retail</span><span class="fx-tag">Low</span></div>
31
+ <div class="fx-row fx-row-on"><span>Atelier Moreau SAS</span><span>Business</span><span class="fx-tag fx-tag-pop">Medium</span></div>
32
+ <div class="fx-row"><span>Hugo Bernard</span><span>Retail</span><span class="fx-tag">Low</span></div>
33
+ <div class="fx-row"><span>Nordlys Trading</span><span>Business</span><span class="fx-tag">Low</span></div>
34
+ </div>
35
+ <span class="fx-arrow" aria-hidden="true">→</span>
36
+ <div class="fx-mock">
37
+ <div class="fx-record-head"><span class="fx-avatar">AM</span><b>Atelier Moreau SAS</b></div>
38
+ <div class="fx-tabs"><span class="fx-tab-on">Details</span><span>Accounts</span><span>KYC</span><span>Activity</span></div>
39
+ <div class="fx-kv"><span>Status</span><b>Active</b></div>
40
+ <div class="fx-kv"><span>Risk rating</span><b>Medium</b></div>
41
+ <div class="fx-kv"><span>Onboarded</span><b>12 Mar 2024</b></div>
42
+ <div class="fx-chips"><span class="fx-chip">3 accounts</span><span class="fx-chip">2 cards</span><span class="fx-chip">1 KYC case</span><span class="fx-chip">📄 Kbis.pdf</span></div>
43
+ </div>
44
+ </div>
45
+ <figcaption class="fx-caption">A list of customers, and one customer’s record with everything linked to it.</figcaption>
46
+ {{/if}}
47
+
48
+ {{#if this.art.segments}}
49
+ <div class="fx-ill">
50
+ <div class="fx-mock fx-mock-wide">
51
+ <div class="fx-seg-tabs"><span>All outgoing transfers</span><span class="fx-seg-on">Transfers to validate</span></div>
52
+ <div class="fx-filter"><span class="fx-filter-chip">Validation status is Pending</span></div>
53
+ <div class="fx-row fx-row-off"><span>€820 · Loyer octobre</span><span class="fx-tag">Not required</span></div>
54
+ <div class="fx-row fx-row-on"><span>€24,500 · Brasserie du Port</span><span class="fx-tag fx-tag-pop">Pending</span></div>
55
+ <div class="fx-row fx-row-off"><span>€18,200 · Kessler GmbH</span><span class="fx-tag">Approved</span></div>
56
+ <div class="fx-row fx-row-on"><span>€41,000 · Nordlys Trading</span><span class="fx-tag fx-tag-pop">Pending</span></div>
57
+ <div class="fx-row fx-row-on"><span>€12,900 · Atelier Moreau SAS</span><span class="fx-tag fx-tag-pop">Pending</span></div>
58
+ </div>
59
+ </div>
60
+ <figcaption class="fx-caption">One saved filter, a name, and the whole team sees the same rows.</figcaption>
61
+ {{/if}}
62
+
63
+ {{#if this.art.inboxes}}
64
+ <div class="fx-ill fx-ill-flow">
65
+ <div class="fx-stack">
66
+ <span class="fx-stack-label">Segment</span>
67
+ <div class="fx-stack-card">KYC #1048</div>
68
+ <div class="fx-stack-card">KYC #1047</div>
69
+ <div class="fx-stack-card">KYC #1046</div>
70
+ <span class="fx-stack-label">oldest first</span>
71
+ </div>
72
+ <span class="fx-arrow" aria-hidden="true">→</span>
73
+ <div class="fx-people">
74
+ <div class="fx-person"><span class="fx-avatar">AN</span><span class="fx-person-task">KYC #1041</span></div>
75
+ <div class="fx-person"><span class="fx-avatar">MX</span><span class="fx-person-task">KYC #1042</span></div>
76
+ <div class="fx-person"><span class="fx-avatar">YOU</span><span class="fx-next">Next ticket →</span></div>
77
+ <span class="fx-stack-label">max 5 tasks each · idle tasks go back</span>
78
+ </div>
79
+ </div>
80
+ <figcaption class="fx-caption">A segment becomes a queue: each analyst gets the next case, nobody gets the same one.</figcaption>
81
+ {{/if}}
82
+
83
+ {{#if this.art.workflows}}
84
+ <div class="fx-ill fx-wf">
85
+ <div class="fx-wf-step"><span class="fx-wf-kind">auto</span>Start the review</div>
86
+ <span class="fx-wf-line" aria-hidden="true"></span>
87
+ <div class="fx-wf-step"><span class="fx-wf-kind">read · Done</span>Read the alert and the payment</div>
88
+ <span class="fx-wf-line" aria-hidden="true"></span>
89
+ <div class="fx-wf-step fx-wf-ai"><span class="fx-wf-kind">✨ AI decides</span>Takeover or other fraud?</div>
90
+ <div class="fx-wf-branches">
91
+ <div class="fx-wf-branch">
92
+ <span class="fx-wf-answer">Takeover</span>
93
+ <div class="fx-wf-step"><span class="fx-wf-kind">action</span>Check device and IP (SEON)</div>
94
+ <div class="fx-wf-step fx-wf-ai"><span class="fx-wf-kind">✨ AI decides</span>Takeover signals?</div>
95
+ <div class="fx-wf-step"><span class="fx-wf-kind">action</span>Revoke device, freeze account</div>
96
+ </div>
97
+ <div class="fx-wf-branch">
98
+ <span class="fx-wf-answer">Other fraud</span>
99
+ <div class="fx-wf-step"><span class="fx-wf-kind">read · Done</span>Read the transactions</div>
100
+ <div class="fx-wf-step"><span class="fx-wf-kind">analyst decides</span>Clear or escalate? · Not sure</div>
101
+ <div class="fx-wf-step fx-wf-esc"><span class="fx-wf-kind">escalation</span>Inbox “Alerts: second look”</div>
102
+ </div>
103
+ </div>
104
+ <span class="fx-wf-line" aria-hidden="true"></span>
105
+ <div class="fx-wf-end">✓ Done</div>
106
+ </div>
107
+ <figcaption class="fx-caption">The fraud alert procedure: automatic steps, steps to read, an AI decision, an escalation.</figcaption>
108
+ {{/if}}
109
+
110
+ {{#if this.art.actions}}
111
+ <div class="fx-ill fx-ill-flow">
112
+ <div class="fx-act-col">
113
+ <span class="fx-btn-mock">Route dispute</span>
114
+ <span class="fx-stack-label">can require a second person’s approval</span>
115
+ </div>
116
+ <span class="fx-arrow" aria-hidden="true">→</span>
117
+ <div class="fx-mock fx-form">
118
+ <b class="fx-form-title">Route dispute</b>
119
+ <span class="fx-form-label">Route</span>
120
+ <span class="fx-form-input">Chargeback ▾</span>
121
+ <span class="fx-form-label">Note</span>
122
+ <span class="fx-form-input fx-form-area">Goods not received, merchant silent for 15 days.</span>
123
+ <span class="fx-form-submit">Submit</span>
124
+ </div>
125
+ <span class="fx-arrow" aria-hidden="true">→</span>
126
+ <div class="fx-result">
127
+ <span class="fx-stack-label">Dispute triage · DSP-2041</span>
128
+ <b>Chargeback opened</b>
129
+ <span>Disputed amount: €389.00</span>
130
+ <span>New case CB-1187</span>
131
+ </div>
132
+ </div>
133
+ <figcaption class="fx-caption">A button, a form, your code in the agent, and a card of what it did.</figcaption>
134
+ {{/if}}
135
+
136
+ {{#if this.art.charts}}
137
+ <div class="fx-ill fx-charts">
138
+ <div class="fx-tile"><span class="fx-tile-value">42</span><span class="fx-tile-label">KYC to review</span></div>
139
+ <div class="fx-tile fx-tile-dark"><span class="fx-tile-value">7</span><span class="fx-tile-label">overdue</span></div>
140
+ <div class="fx-bars" aria-hidden="true">
141
+ <span style="height: 40%"></span><span style="height: 65%"></span><span style="height: 50%"></span><span style="height: 80%"></span><span style="height: 60%"></span><span style="height: 95%"></span><span style="height: 70%"></span>
142
+ </div>
143
+ <div class="fx-donut" aria-hidden="true"><span></span></div>
144
+ </div>
145
+ <figcaption class="fx-caption">Counters, a trend and a breakdown, computed live when the page opens.</figcaption>
146
+ {{/if}}
147
+
148
+ {{#if this.art.workspaces}}
149
+ <div class="fx-ill fx-ws">
150
+ <div class="fx-ws-top"><b>🛂 Onboarding desk</b><span class="fx-ws-toggle">Layout editor ●</span></div>
151
+ <div class="fx-ws-counters"><span>12</span><span>5</span><span>3</span><span>36</span><span>40</span></div>
152
+ <div class="fx-ws-body">
153
+ <div class="fx-ws-block fx-ws-inbox">📥 Inbox<span></span><span></span><span></span></div>
154
+ <div class="fx-ws-side">
155
+ <div class="fx-ws-block fx-ws-btn">▶ Retail onboarding</div>
156
+ <div class="fx-ws-block fx-ws-btn">Approve KYC</div>
157
+ <div class="fx-ws-block fx-ws-drag">⠿ drag a component</div>
158
+ </div>
159
+ </div>
160
+ <div class="fx-ws-block fx-ws-tabs"><span class="fx-tab-on">Case</span><span>People</span><span>Documents</span><span>Requests</span></div>
161
+ </div>
162
+ <figcaption class="fx-caption">A desk: counters, the inbox, the buttons for the picked case, its fields in tabs.</figcaption>
163
+ {{/if}}
164
+
165
+ {{#if this.art.custom}}
166
+ <div class="fx-ill fx-ill-flow">
167
+ <div class="fx-files">
168
+ <div class="fx-file"><b>template.hbs</b><span>&lt;h1&gt;Welcome&lt;/h1&gt;</span></div>
169
+ <div class="fx-file"><b>component.js</b><span>fetch('/forest/_charts/…')</span></div>
170
+ <div class="fx-file"><b>style.css</b><span>.card { color: … }</span></div>
171
+ </div>
172
+ <span class="fx-arrow" aria-hidden="true">→</span>
173
+ <div class="fx-act-col">
174
+ <span class="fx-pipe">a CDN<br />…/hub/</span>
175
+ </div>
176
+ <span class="fx-arrow" aria-hidden="true">→</span>
177
+ <div class="fx-mock fx-rendered">
178
+ <b>Welcome to the bank’s back office</b>
179
+ <span class="fx-rendered-card">🛂 Onboarding desk <i>12 to review</i></span>
180
+ <span class="fx-rendered-card">🚨 Alerts desk <i>9 to review</i></span>
181
+ </div>
182
+ </div>
183
+ <figcaption class="fx-caption">Three files served by your agent, drawn inside a Forest page.</figcaption>
184
+ {{/if}}
185
+
186
+ {{#if this.art.roles}}
187
+ <div class="fx-ill">
188
+ <div class="fx-mock fx-mock-wide fx-matrix">
189
+ <div class="fx-matrix-row fx-matrix-head"><span></span><span>Analyst</span><span>MLRO</span><span>Auditor</span></div>
190
+ <div class="fx-matrix-row"><span>See investigations</span><span class="fx-yes">✓</span><span class="fx-yes">✓</span><span class="fx-yes">✓</span></div>
191
+ <div class="fx-matrix-row"><span>Edit a case</span><span class="fx-yes">✓</span><span class="fx-yes">✓</span><span class="fx-no">–</span></div>
192
+ <div class="fx-matrix-row"><span>Draft SAR</span><span class="fx-yes">✓</span><span class="fx-yes">✓</span><span class="fx-no">–</span></div>
193
+ <div class="fx-matrix-row"><span>File SAR</span><span class="fx-ask">asks approval</span><span class="fx-yes">approves</span><span class="fx-no">–</span></div>
194
+ <div class="fx-matrix-row"><span>Export</span><span class="fx-no">–</span><span class="fx-yes">✓</span><span class="fx-yes">✓</span></div>
195
+ </div>
196
+ <div class="fx-chips fx-chips-center"><span class="fx-chip">Team Operations</span><span class="fx-chip">Team Compliance</span><span class="fx-chip">Team Payments</span></div>
197
+ </div>
198
+ <figcaption class="fx-caption">Roles say what each person may do; teams say which pages they see.</figcaption>
199
+ {{/if}}
200
+
201
+ {{#if this.art.agent}}
202
+ <div class="fx-ill fx-net">
203
+ <div class="fx-net-node fx-net-browser">💻 Your browser<small>app.forestadmin.com</small></div>
204
+ <span class="fx-net-link fx-net-c1">↕ interface, layouts</span>
205
+ <span class="fx-net-link fx-net-link-pop fx-net-c3">↕ your data, direct</span>
206
+ <div class="fx-net-node fx-net-c1">☁️ Forest servers<small>layouts · permissions · schema</small></div>
207
+ <span class="fx-net-arrow fx-net-c2">← schema only</span>
208
+ <div class="fx-net-node fx-net-yours fx-net-c3">🛡️ Your agent<small>localhost:3310</small></div>
209
+ <span class="fx-net-link fx-net-c3">↕</span>
210
+ <div class="fx-net-node fx-net-db fx-net-c3">🗄️ Your database<small>stays on your side</small></div>
211
+ </div>
212
+ <figcaption class="fx-caption">The browser asks your agent for the rows. Forest only knows the shape of the tables.</figcaption>
213
+ {{/if}}
214
+
215
+ {{#if this.art.ai}}
216
+ <div class="fx-ill">
217
+ <div class="fx-wf-step fx-wf-ai fx-ai-q"><span class="fx-wf-kind">✨ AI decides</span>Takeover or other fraud?</div>
218
+ <div class="fx-bubble">
219
+ <b>AI chose: Takeover</b>
220
+ <span>The rule that fired is “Account takeover”: a new device and a new payee, the payment sent 3 minutes after the login.</span>
221
+ <span class="fx-bubble-foot">The analyst sees why, and can take the other branch.</span>
222
+ </div>
223
+ <div class="fx-mcp">
224
+ <span class="fx-mcp-node">🤖 Claude, Cursor…</span>
225
+ <span class="fx-mcp-link">⇄ MCP ⇄</span>
226
+ <span class="fx-mcp-node">🛡️ Your agent</span>
227
+ </div>
228
+ <span class="fx-stack-label fx-center">same permissions as the user · every call logged</span>
229
+ </div>
230
+ <figcaption class="fx-caption">AI inside the procedure, and AI assistants through MCP, both inside your rules.</figcaption>
231
+ {{/if}}
232
+
233
+ {{#if this.art.activity}}
234
+ <div class="fx-ill">
235
+ <div class="fx-timeline">
236
+ <div class="fx-event"><span class="fx-event-time">10:42</span><span><b>Ana</b> ran <b>Approve KYC</b> on KYC case #1041</span></div>
237
+ <div class="fx-event"><span class="fx-event-time">10:39</span><span><b>Ana</b> finished step “Check the ID” of Retail onboarding</span></div>
238
+ <div class="fx-event"><span class="fx-event-time">10:31</span><span><b>Ana</b> took KYC case #1041 from Retail onboarding</span></div>
239
+ <div class="fx-event"><span class="fx-event-time">09:58</span><span><b>Max</b> edited <b>Risk rating</b> on Atelier Moreau SAS</span></div>
240
+ <div class="fx-event"><span class="fx-event-time">09:12</span><span><b>Léa</b> approved <b>File SAR</b> requested by Max</span></div>
241
+ </div>
242
+ </div>
243
+ <figcaption class="fx-caption">Who did what, on which record, and when.</figcaption>
244
+ {{/if}}
245
+ </figure>
246
+ </section>
247
+
248
+ <section class="fx-live">
249
+ <div class="fx-live-head">
250
+ <h2 class="fx-h2 fx-on-dark">See it live in this demo</h2>
251
+ <span class="fx-live-note">{{this.liveNote}}</span>
252
+ </div>
253
+ {{#if this.feature.liveText}}
254
+ <p class="fx-live-text">{{this.feature.liveText}}</p>
255
+ {{/if}}
256
+ {{#if this.hasFacts}}
257
+ <div class="fx-facts">
258
+ {{#each this.facts as |fact|}}
259
+ <div class="fx-fact">
260
+ <span class="fx-fact-value">{{fact.value}}</span>
261
+ <span class="fx-fact-label">{{fact.label}}</span>
262
+ </div>
263
+ {{/each}}
264
+ </div>
265
+ {{/if}}
266
+ <div class="fx-actions">
267
+ {{#each this.feature.buttons as |button|}}
268
+ <button type="button" class="fx-go" {{on "click" (fn this.open button)}}>{{button.label}} →</button>
269
+ {{/each}}
270
+ </div>
271
+ </section>
272
+
273
+ <section class="fx-setup">
274
+ <h2 class="fx-h2">How to set it up</h2>
275
+ <ol class="fx-steps">
276
+ {{#each this.steps as |step|}}
277
+ <li class="fx-step"><span class="fx-step-number">{{step.number}}</span><span class="fx-step-text">{{step.text}}</span></li>
278
+ {{/each}}
279
+ </ol>
280
+ <a class="fx-docs" href={{this.feature.docs}} target="_blank" rel="noopener noreferrer">Read more in the Forest docs ↗</a>
281
+ </section>
282
+
283
+ <footer class="fx-footer">
284
+ <button type="button" class="fx-back fx-back-big" {{on "click" this.openHub}}>← Back to the Hub</button>
285
+ </footer>
286
+ </div>
@@ -0,0 +1,4 @@
1
+ <div class={{this.rootClass}}>
2
+ <button type="button" class={{this.buttonClass}} style={{this.buttonStyle}} disabled={{this.locked}} title={{this.tip}} {{on "click" this.open}}>{{this.label}}</button>
3
+ {{#if this.locked}}<span class="sf-tip" role="tooltip" style={{this.tipStyle}}>{{this.tip}}</span>{{/if}}
4
+ </div>
@@ -0,0 +1,217 @@
1
+ /* eslint-disable import/no-unresolved -- runs inside the Forest app, which provides these */
2
+ /* eslint-env browser */
3
+ /**
4
+ * Go to: a workspace Custom component, one button that opens another workspace, in the same look
5
+ * as the Select first button (it shares select-first.css). The target and the text are in the
6
+ * component's own url: `go-to.js?workspace=<workspace id>&label=<text>`. Served by the agent as
7
+ * hub/go-to.{hbs,js} (select-first-files.js). The text's size follows the button's box.
8
+ *
9
+ * As Select first, `after=KYC-DEMO-0002&afterStatus=PENDING_APPROVAL,APPROVED` (and `list`,
10
+ * default List_Untreated; `tip`) keeps it grey, with a hint on hover, until that row of the list
11
+ * shows one of those statuses: the senior's desk opens once case 2 was escalated.
12
+ *
13
+ * `unlock=simplified|senior` waits on the visitor instead: the agent's demo_guide chart answers
14
+ * `unlocked` (an action run on the Simplified desk; a case decided on the senior's).
15
+ *
16
+ * `look=back` draws it as the desks' "← Hub" pill: a way back, not the next step. `look=link`
17
+ * draws it as a native link component's text (`color`, `size` in px, `weight`, `align`): what a
18
+ * link to a workspace becomes in a template that cannot know the project's name (its url).
19
+ */
20
+ import { action } from '@ember/object';
21
+ import { inject as service } from '@ember/service';
22
+ import { htmlSafe } from '@ember/template';
23
+ import Component from '@glimmer/component';
24
+ import { tracked } from '@glimmer/tracking';
25
+
26
+ /** look=link: the native link's text settings, each kept only when it is a plain value. */
27
+ function linkStyle(params) {
28
+ const keep = (name, pattern, css) =>
29
+ pattern.test(params.get(name) || '') ? css(params.get(name)) : '';
30
+
31
+ return [
32
+ keep('color', /^#[0-9a-f]{3,8}$/i, v => `color:${v}`),
33
+ keep('size', /^\d{1,3}$/, v => `font-size:${v}px`),
34
+ keep('weight', /^(normal|bold|[1-9]00)$/, v => `font-weight:${v}`),
35
+ keep('align', /^(left|center|right)$/, v => `text-align:${v}`),
36
+ ]
37
+ .filter(Boolean)
38
+ .join(';');
39
+ }
40
+
41
+ // Forest's grid cell, in px (WORKSPACE_GRID_CELL_WIDTH and _HEIGHT).
42
+ const CELL = 20;
43
+ const LOCK_POLL_MS = 1500;
44
+ const DEFAULT_TIP = 'Escalate the second case to a senior officer first!';
45
+ const UNLOCK_TIPS = {
46
+ simplified: 'Try at least one action first, like "Change preferred language"!',
47
+ senior: 'Decide at least one case first!',
48
+ };
49
+ const listOf = rows => (rows && rows.toArray ? rows.toArray() : Array.from(rows || []));
50
+ // A row's fields are its "forest-<field>" attributes (Forest's model namespace).
51
+ const fieldOf = (row, name) =>
52
+ row?.[`forest-${name}`] ?? row?.getAttributesSerialized?.()[name] ?? row?.[name];
53
+ const UUID = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/g;
54
+
55
+ /** As select-first's: one line, at most 40% of the box's height, the whole text in its width. */
56
+ function fittedFont(component, text, { min = 11, max = 36 } = {}) {
57
+ const box = component?.displaySettings;
58
+ if (!box?.width || !box?.height) return null;
59
+ const byHeight = box.height * CELL * 0.4;
60
+ const byWidth = (box.width * CELL - 44) / (0.6 * Math.max(String(text).length, 1));
61
+
62
+ return Math.round(Math.max(min, Math.min(max, byHeight, byWidth)));
63
+ }
64
+
65
+ /**
66
+ * The hint bubble's text size: the largest that fits the whole hint inside the box, on one, two
67
+ * or three lines (the bubble covers the button; Forest's cell cuts anything outside it).
68
+ */
69
+ function tipFont(component, text) {
70
+ const box = component?.displaySettings;
71
+ if (!box?.width || !box?.height) return null;
72
+ const length = Math.max(String(text || '').length, 1);
73
+ const best = Math.max(
74
+ ...[1, 2, 3].map(lines =>
75
+ // Lines of 1.3 em plus 0.6 em of padding; 0.62 em a character (bold) plus 1.4 em of padding.
76
+ Math.min(
77
+ (box.height * CELL * 0.92) / (lines * 1.3 + 0.6),
78
+ (box.width * CELL * 0.94) / (0.62 * Math.ceil(length / lines) + 1.4),
79
+ ),
80
+ ),
81
+ );
82
+
83
+ return Math.round(Math.max(12, Math.min(30, best)));
84
+ }
85
+
86
+ export default class GoTo extends Component {
87
+ @service router;
88
+
89
+ @service lianaServerFetch;
90
+
91
+ // The agent's answer for `unlock=`: null until it comes.
92
+ @tracked unlockedByAgent = null;
93
+
94
+ // Bumped every LOCK_POLL_MS while the button waits on a row, so `locked` reads again.
95
+ @tracked tick = 0;
96
+
97
+ constructor(owner, args) {
98
+ super(owner, args);
99
+
100
+ if (this.params.get('after') || this.params.get('unlock')) {
101
+ this.timer = window.setInterval(() => {
102
+ this.tick += 1;
103
+ this.askAgent();
104
+ }, LOCK_POLL_MS);
105
+ this.askAgent();
106
+ }
107
+ }
108
+
109
+ willDestroy(...args) {
110
+ super.willDestroy?.(...args);
111
+ window.clearInterval(this.timer);
112
+ }
113
+
114
+ get params() {
115
+ const url = this.args.component?.options?.componentUrl || '';
116
+
117
+ return new URLSearchParams(url.split('?')[1] || '');
118
+ }
119
+
120
+ get label() {
121
+ return this.params.get('label') || 'Open the next workspace';
122
+ }
123
+
124
+ /** For `unlock=`: does the agent say the visitor did what opens this button? */
125
+ async askAgent() {
126
+ const desk = this.params.get('unlock');
127
+ if (!desk || this.unlockedByAgent) return;
128
+
129
+ try {
130
+ const response = await this.lianaServerFetch.fetch(
131
+ `/forest/_charts/demo_guide?desk=${encodeURIComponent(desk)}`,
132
+ {},
133
+ );
134
+ if (response.ok) this.unlockedByAgent = Boolean((await response.json())?.unlocked);
135
+ } catch (error) {
136
+ // The next poll asks again.
137
+ }
138
+ }
139
+
140
+ /**
141
+ * Waiting: on the agent (`unlock=`), or on a row of the list (the one named by `after` has
142
+ * none of `afterStatus` yet).
143
+ */
144
+ get locked() {
145
+ if (this.params.get('unlock')) return !this.unlockedByAgent;
146
+ const after = this.params.get('after');
147
+ if (!after) return false;
148
+ // eslint-disable-next-line no-unused-expressions, @typescript-eslint/no-unused-expressions -- read to recompute on each poll
149
+ this.tick;
150
+ const list = this.args.component?.getWorkspaceComponentFromName?.(
151
+ this.params.get('list') || 'List_Untreated',
152
+ );
153
+ const row = listOf(list?.options?.recordsContext?.records).find(
154
+ r => fieldOf(r, 'reference') === after,
155
+ );
156
+ const wanted = (this.params.get('afterStatus') || 'APPROVED').split(',');
157
+
158
+ return !wanted.includes(fieldOf(row, 'status'));
159
+ }
160
+
161
+ get tip() {
162
+ if (!this.locked) return null;
163
+
164
+ return this.params.get('tip') || UNLOCK_TIPS[this.params.get('unlock')] || DEFAULT_TIP;
165
+ }
166
+
167
+ get buttonClass() {
168
+ const look = this.params.get('look');
169
+ if (look === 'back') return 'sf-button sf-button--back';
170
+
171
+ return look === 'link' ? 'sf-button sf-button--link' : 'sf-button';
172
+ }
173
+
174
+ get tipStyle() {
175
+ const size = this.tip ? tipFont(this.args.component, this.tip) : null;
176
+
177
+ return size ? htmlSafe(`font-size:${size}px`) : null;
178
+ }
179
+
180
+ get rootClass() {
181
+ return this.locked ? 'sf sf--locked' : 'sf';
182
+ }
183
+
184
+ get buttonStyle() {
185
+ if (this.params.get('look') === 'link') return htmlSafe(linkStyle(this.params));
186
+ const size = fittedFont(this.args.component, this.label);
187
+
188
+ return size ? htmlSafe(`font-size:${size}px`) : null;
189
+ }
190
+
191
+ /** The current url with the workspace id swapped (as the Hub's buttons do). */
192
+ get path() {
193
+ const target = this.params.get('workspace');
194
+ const path = window.location.pathname;
195
+ const ids = path.match(UUID) || [];
196
+ const current = ids[ids.length - 1];
197
+ if (!target || !current) return null;
198
+ const at = path.lastIndexOf(current);
199
+
200
+ return `${path.slice(0, at)}${target}`;
201
+ }
202
+
203
+ @action
204
+ open() {
205
+ const { path } = this;
206
+ if (!path || this.locked) return;
207
+
208
+ try {
209
+ const transition = this.router.transitionTo(path);
210
+ transition?.catch?.(error => {
211
+ if (error?.name !== 'TransitionAborted') window.location.assign(path);
212
+ });
213
+ } catch (error) {
214
+ window.location.assign(path);
215
+ }
216
+ }
217
+ }