@rippling/rippling-sdk 0.2.0-alpha.35 → 0.2.0-alpha.37
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/client.d.mts +13 -1
- package/client.d.mts.map +1 -1
- package/client.d.ts +13 -1
- package/client.d.ts.map +1 -1
- package/client.js +13 -1
- package/client.js.map +1 -1
- package/client.mjs +13 -1
- package/client.mjs.map +1 -1
- package/examples/.keep +4 -0
- package/examples/manifest/dental-practice-management/dental-practice-management.ts +638 -0
- package/examples/manifest/dental-practice-management/manifest.json +1870 -0
- package/examples/manifest/gym-membership-management/gym-membership-management.ts +746 -0
- package/examples/manifest/gym-membership-management/manifest.json +1975 -0
- package/examples/sdui/sdui-crud-todo/rippling-function.ts +367 -0
- package/examples/sdui/sdui-crud-todo/sdui-crud-todo.ts +282 -0
- package/examples/sdui/sdui-showcase/rippling-function.ts +381 -0
- package/examples/sdui/sdui-showcase/sdui-showcase.ts +351 -0
- package/examples/sdui/sdui-tab-multi-view/rippling-function.ts +1061 -0
- package/examples/sdui/sdui-tab-multi-view/sdui-tab-multi-view.ts +924 -0
- package/examples/sdui/vote/rippling-function.ts +330 -0
- package/examples/sdui/vote/vote.ts +298 -0
- package/internal/utils/log.d.mts.map +1 -1
- package/internal/utils/log.d.ts.map +1 -1
- package/internal/utils/log.js +2 -0
- package/internal/utils/log.js.map +1 -1
- package/internal/utils/log.mjs +2 -0
- package/internal/utils/log.mjs.map +1 -1
- package/lib/manifest/custom-object-field-section.d.mts +4 -0
- package/lib/manifest/custom-object-field-section.d.mts.map +1 -1
- package/lib/manifest/custom-object-field-section.d.ts +4 -0
- package/lib/manifest/custom-object-field-section.d.ts.map +1 -1
- package/lib/manifest/custom-object-field-section.js +6 -0
- package/lib/manifest/custom-object-field-section.js.map +1 -1
- package/lib/manifest/custom-object-field-section.mjs +6 -0
- package/lib/manifest/custom-object-field-section.mjs.map +1 -1
- package/lib/manifest/custom-object-page-layout.d.mts +21 -13
- package/lib/manifest/custom-object-page-layout.d.mts.map +1 -1
- package/lib/manifest/custom-object-page-layout.d.ts +21 -13
- package/lib/manifest/custom-object-page-layout.d.ts.map +1 -1
- package/lib/manifest/custom-object-page-layout.js +119 -9
- package/lib/manifest/custom-object-page-layout.js.map +1 -1
- package/lib/manifest/custom-object-page-layout.mjs +119 -9
- package/lib/manifest/custom-object-page-layout.mjs.map +1 -1
- package/lib/manifest/field.d.mts +5 -1
- package/lib/manifest/field.d.mts.map +1 -1
- package/lib/manifest/field.d.ts +5 -1
- package/lib/manifest/field.d.ts.map +1 -1
- package/lib/manifest/field.js +8 -0
- package/lib/manifest/field.js.map +1 -1
- package/lib/manifest/field.mjs +8 -0
- package/lib/manifest/field.mjs.map +1 -1
- package/lib/manifest/index.d.mts +1 -1
- package/lib/manifest/index.d.mts.map +1 -1
- package/lib/manifest/index.d.ts +1 -1
- package/lib/manifest/index.d.ts.map +1 -1
- package/lib/manifest/index.js.map +1 -1
- package/lib/manifest/index.mjs.map +1 -1
- package/package.json +11 -1
- package/resources/company-legal-entities.d.mts +180 -0
- package/resources/company-legal-entities.d.mts.map +1 -0
- package/resources/company-legal-entities.d.ts +180 -0
- package/resources/company-legal-entities.d.ts.map +1 -0
- package/resources/company-legal-entities.js +30 -0
- package/resources/company-legal-entities.js.map +1 -0
- package/resources/company-legal-entities.mjs +26 -0
- package/resources/company-legal-entities.mjs.map +1 -0
- package/resources/company-legal-entity-workers.d.mts +79 -0
- package/resources/company-legal-entity-workers.d.mts.map +1 -0
- package/resources/company-legal-entity-workers.d.ts +79 -0
- package/resources/company-legal-entity-workers.d.ts.map +1 -0
- package/resources/company-legal-entity-workers.js +30 -0
- package/resources/company-legal-entity-workers.js.map +1 -0
- package/resources/company-legal-entity-workers.mjs +26 -0
- package/resources/company-legal-entity-workers.mjs.map +1 -0
- package/resources/earning-types.d.mts +1 -6
- package/resources/earning-types.d.mts.map +1 -1
- package/resources/earning-types.d.ts +1 -6
- package/resources/earning-types.d.ts.map +1 -1
- package/resources/earning-types.js +1 -1
- package/resources/earning-types.mjs +1 -1
- package/resources/earnings-inputs.d.mts +1 -1
- package/resources/earnings-inputs.d.ts +1 -1
- package/resources/earnings-inputs.js +1 -1
- package/resources/earnings-inputs.mjs +1 -1
- package/resources/index.d.mts +3 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +3 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +7 -3
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +3 -1
- package/resources/index.mjs.map +1 -1
- package/resources/legal-entities.d.mts +1 -1
- package/resources/legal-entities.d.mts.map +1 -1
- package/resources/legal-entities.d.ts +1 -1
- package/resources/legal-entities.d.ts.map +1 -1
- package/resources/payroll-runs/index.d.mts +3 -0
- package/resources/payroll-runs/index.d.mts.map +1 -0
- package/resources/payroll-runs/index.d.ts +3 -0
- package/resources/payroll-runs/index.d.ts.map +1 -0
- package/resources/payroll-runs/index.js +9 -0
- package/resources/payroll-runs/index.js.map +1 -0
- package/resources/payroll-runs/index.mjs +4 -0
- package/resources/payroll-runs/index.mjs.map +1 -0
- package/resources/payroll-runs/payroll-runs.d.mts +199 -0
- package/resources/payroll-runs/payroll-runs.d.mts.map +1 -0
- package/resources/payroll-runs/payroll-runs.d.ts +199 -0
- package/resources/payroll-runs/payroll-runs.d.ts.map +1 -0
- package/resources/payroll-runs/payroll-runs.js +40 -0
- package/resources/payroll-runs/payroll-runs.js.map +1 -0
- package/resources/payroll-runs/payroll-runs.mjs +35 -0
- package/resources/payroll-runs/payroll-runs.mjs.map +1 -0
- package/resources/payroll-runs/worker-payroll-records.d.mts +200 -0
- package/resources/payroll-runs/worker-payroll-records.d.mts.map +1 -0
- package/resources/payroll-runs/worker-payroll-records.d.ts +200 -0
- package/resources/payroll-runs/worker-payroll-records.d.ts.map +1 -0
- package/resources/payroll-runs/worker-payroll-records.js +23 -0
- package/resources/payroll-runs/worker-payroll-records.js.map +1 -0
- package/resources/payroll-runs/worker-payroll-records.mjs +19 -0
- package/resources/payroll-runs/worker-payroll-records.mjs.map +1 -0
- package/resources/payroll-runs.d.mts +1 -194
- package/resources/payroll-runs.d.mts.map +1 -1
- package/resources/payroll-runs.d.ts +1 -194
- package/resources/payroll-runs.d.ts.map +1 -1
- package/resources/payroll-runs.js +2 -28
- package/resources/payroll-runs.js.map +1 -1
- package/resources/payroll-runs.mjs +1 -26
- package/resources/payroll-runs.mjs.map +1 -1
- package/src/client.ts +47 -7
- package/src/internal/utils/log.ts +2 -0
- package/src/lib/manifest/custom-object-field-section.ts +7 -0
- package/src/lib/manifest/custom-object-page-layout.ts +220 -18
- package/src/lib/manifest/field.ts +9 -1
- package/src/lib/manifest/index.ts +2 -0
- package/src/resources/company-legal-entities.ts +237 -0
- package/src/resources/company-legal-entity-workers.ts +115 -0
- package/src/resources/earning-types.ts +1 -7
- package/src/resources/earnings-inputs.ts +1 -1
- package/src/resources/index.ts +15 -1
- package/src/resources/legal-entities.ts +1 -1
- package/src/resources/payroll-runs/index.ts +15 -0
- package/src/resources/payroll-runs/payroll-runs.ts +270 -0
- package/src/resources/payroll-runs/worker-payroll-records.ts +255 -0
- package/src/resources/payroll-runs.ts +1 -249
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* PASTE INTO THE RIPPLING FUNCTION EDITOR TO PREVIEW. DEPENDS ON
|
|
4
|
+
* @rippling/rippling-sdk AND @rippling/sdui-builder. MOCK POLL ONLY.
|
|
5
|
+
* ----------------------------------------------------------------------------
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
import SDUI from '@rippling/sdui-builder';
|
|
10
|
+
import { FunctionContext, FunctionEvent, FunctionResponse } from '@rippling/rippling-sdk';
|
|
11
|
+
|
|
12
|
+
// Whole-number percentages that sum to 100 — matches what DistributionBar
|
|
13
|
+
// and ProgressBar both expect, so they tell the same visual story.
|
|
14
|
+
const PCT_V = 52;
|
|
15
|
+
const PCT_Q = 33;
|
|
16
|
+
const PCT_D = 15;
|
|
17
|
+
const POLL_TOTAL = PCT_V + PCT_Q + PCT_D;
|
|
18
|
+
|
|
19
|
+
const POLL_SEGMENTS = [
|
|
20
|
+
{ value: PCT_V, segmentColor: '#4F46E5' },
|
|
21
|
+
{ value: PCT_Q, segmentColor: '#059669' },
|
|
22
|
+
{ value: PCT_D, segmentColor: '#EA580C' },
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
function renderSpec(_functionId: string) {
|
|
26
|
+
const s = SDUI.createState({
|
|
27
|
+
voteChoice: '',
|
|
28
|
+
resultsVisible: false,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Vote cards: every card gets the same explicit width: '33%' so they're
|
|
32
|
+
// mathematically equal regardless of content length. justify 'space-between'
|
|
33
|
+
// is a real CSS value (unlike 'stretch') so layout actually applies.
|
|
34
|
+
const voteCards = SDUI.components.HStack({
|
|
35
|
+
gap: 'space500',
|
|
36
|
+
wrap: false,
|
|
37
|
+
justify: 'space-between',
|
|
38
|
+
align: 'stretch',
|
|
39
|
+
children: [
|
|
40
|
+
SDUI.components.Layout({
|
|
41
|
+
width: '33%',
|
|
42
|
+
children: [
|
|
43
|
+
SDUI.components.Card({
|
|
44
|
+
title: 'Ship faster',
|
|
45
|
+
padding: '32',
|
|
46
|
+
children: [
|
|
47
|
+
SDUI.components.VStack({
|
|
48
|
+
gap: 'space500',
|
|
49
|
+
align: 'stretch',
|
|
50
|
+
children: [
|
|
51
|
+
SDUI.components.Text({
|
|
52
|
+
text: 'More releases, shorter cycles.',
|
|
53
|
+
typestyle: 'bodyLg',
|
|
54
|
+
color: 'secondary',
|
|
55
|
+
}),
|
|
56
|
+
SDUI.components.Button({
|
|
57
|
+
label: 'Vote',
|
|
58
|
+
appearance: 'PRIMARY',
|
|
59
|
+
size: 'L',
|
|
60
|
+
onPress: [
|
|
61
|
+
SDUI.actions.set(s.voteChoice, 'velocity'),
|
|
62
|
+
SDUI.actions.set(s.resultsVisible, true),
|
|
63
|
+
],
|
|
64
|
+
}),
|
|
65
|
+
],
|
|
66
|
+
}),
|
|
67
|
+
],
|
|
68
|
+
}),
|
|
69
|
+
],
|
|
70
|
+
}),
|
|
71
|
+
SDUI.components.Layout({
|
|
72
|
+
width: '33%',
|
|
73
|
+
children: [
|
|
74
|
+
SDUI.components.Card({
|
|
75
|
+
title: 'Raise quality',
|
|
76
|
+
padding: '32',
|
|
77
|
+
children: [
|
|
78
|
+
SDUI.components.VStack({
|
|
79
|
+
gap: 'space500',
|
|
80
|
+
align: 'stretch',
|
|
81
|
+
children: [
|
|
82
|
+
SDUI.components.Text({
|
|
83
|
+
text: 'Fewer bugs, better UX.',
|
|
84
|
+
typestyle: 'bodyLg',
|
|
85
|
+
color: 'secondary',
|
|
86
|
+
}),
|
|
87
|
+
SDUI.components.Button({
|
|
88
|
+
label: 'Vote',
|
|
89
|
+
appearance: 'SUCCESS',
|
|
90
|
+
size: 'L',
|
|
91
|
+
onPress: [
|
|
92
|
+
SDUI.actions.set(s.voteChoice, 'quality'),
|
|
93
|
+
SDUI.actions.set(s.resultsVisible, true),
|
|
94
|
+
],
|
|
95
|
+
}),
|
|
96
|
+
],
|
|
97
|
+
}),
|
|
98
|
+
],
|
|
99
|
+
}),
|
|
100
|
+
],
|
|
101
|
+
}),
|
|
102
|
+
SDUI.components.Layout({
|
|
103
|
+
width: '33%',
|
|
104
|
+
children: [
|
|
105
|
+
SDUI.components.Card({
|
|
106
|
+
title: 'Pay down debt',
|
|
107
|
+
padding: '32',
|
|
108
|
+
children: [
|
|
109
|
+
SDUI.components.VStack({
|
|
110
|
+
gap: 'space500',
|
|
111
|
+
align: 'stretch',
|
|
112
|
+
children: [
|
|
113
|
+
SDUI.components.Text({
|
|
114
|
+
text: 'Refactors and infra.',
|
|
115
|
+
typestyle: 'bodyLg',
|
|
116
|
+
color: 'secondary',
|
|
117
|
+
}),
|
|
118
|
+
SDUI.components.Button({
|
|
119
|
+
label: 'Vote',
|
|
120
|
+
appearance: 'WARNING',
|
|
121
|
+
size: 'L',
|
|
122
|
+
onPress: [
|
|
123
|
+
SDUI.actions.set(s.voteChoice, 'debt'),
|
|
124
|
+
SDUI.actions.set(s.resultsVisible, true),
|
|
125
|
+
],
|
|
126
|
+
}),
|
|
127
|
+
],
|
|
128
|
+
}),
|
|
129
|
+
],
|
|
130
|
+
}),
|
|
131
|
+
],
|
|
132
|
+
}),
|
|
133
|
+
],
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
const shell = SDUI.components.Layout({
|
|
137
|
+
width: '100%',
|
|
138
|
+
maxWidth: '1200px',
|
|
139
|
+
margin: { left: 'auto', right: 'auto' },
|
|
140
|
+
padding: { top: 48, bottom: 56, left: 32, right: 32 },
|
|
141
|
+
children: [
|
|
142
|
+
SDUI.components.VStack({
|
|
143
|
+
gap: 'space700',
|
|
144
|
+
align: 'stretch',
|
|
145
|
+
children: [
|
|
146
|
+
SDUI.components.VStack({
|
|
147
|
+
gap: 'space300',
|
|
148
|
+
align: 'center',
|
|
149
|
+
children: [
|
|
150
|
+
SDUI.components.Heading({
|
|
151
|
+
level: '1',
|
|
152
|
+
align: 'center',
|
|
153
|
+
text: 'Where should we focus next quarter?',
|
|
154
|
+
}),
|
|
155
|
+
SDUI.components.Text({
|
|
156
|
+
align: 'center',
|
|
157
|
+
maxWidth: '680px',
|
|
158
|
+
text: 'One vote. Percentages are mock data — swap in real counts later.',
|
|
159
|
+
typestyle: 'bodyLg',
|
|
160
|
+
color: 'secondary',
|
|
161
|
+
}),
|
|
162
|
+
],
|
|
163
|
+
}),
|
|
164
|
+
SDUI.components.Divider({}),
|
|
165
|
+
voteCards,
|
|
166
|
+
SDUI.components.HStack({
|
|
167
|
+
gap: 'space300',
|
|
168
|
+
justify: 'center',
|
|
169
|
+
wrap: true,
|
|
170
|
+
children: [
|
|
171
|
+
SDUI.components.Chip({
|
|
172
|
+
text: 'Start over',
|
|
173
|
+
appearance: 'NEUTRAL',
|
|
174
|
+
onPress: [
|
|
175
|
+
SDUI.actions.set(s.voteChoice, ''),
|
|
176
|
+
SDUI.actions.set(s.resultsVisible, false),
|
|
177
|
+
],
|
|
178
|
+
}),
|
|
179
|
+
],
|
|
180
|
+
}),
|
|
181
|
+
SDUI.visible(
|
|
182
|
+
SDUI.conditions.falsy(s.resultsVisible),
|
|
183
|
+
SDUI.components.Text({
|
|
184
|
+
align: 'center',
|
|
185
|
+
maxWidth: '560px',
|
|
186
|
+
typestyle: 'bodyMd',
|
|
187
|
+
color: 'secondary',
|
|
188
|
+
text: 'Tap Vote — results open below with a split bar plus one bar per option.',
|
|
189
|
+
}),
|
|
190
|
+
),
|
|
191
|
+
SDUI.visible(
|
|
192
|
+
SDUI.conditions.truthy(s.resultsVisible),
|
|
193
|
+
SDUI.components.VStack({
|
|
194
|
+
gap: 'space500',
|
|
195
|
+
align: 'stretch',
|
|
196
|
+
children: [
|
|
197
|
+
// The "you voted" badge sits centered above the result card
|
|
198
|
+
SDUI.components.HStack({
|
|
199
|
+
gap: 'space200',
|
|
200
|
+
justify: 'center',
|
|
201
|
+
wrap: true,
|
|
202
|
+
children: [
|
|
203
|
+
SDUI.visible(
|
|
204
|
+
SDUI.conditions.eq(s.voteChoice, 'velocity'),
|
|
205
|
+
SDUI.components.Badge({
|
|
206
|
+
text: 'You voted · Ship faster',
|
|
207
|
+
appearance: 'PRIMARY',
|
|
208
|
+
}),
|
|
209
|
+
),
|
|
210
|
+
SDUI.visible(
|
|
211
|
+
SDUI.conditions.eq(s.voteChoice, 'quality'),
|
|
212
|
+
SDUI.components.Badge({
|
|
213
|
+
text: 'You voted · Raise quality',
|
|
214
|
+
appearance: 'SUCCESS',
|
|
215
|
+
}),
|
|
216
|
+
),
|
|
217
|
+
SDUI.visible(
|
|
218
|
+
SDUI.conditions.eq(s.voteChoice, 'debt'),
|
|
219
|
+
SDUI.components.Badge({
|
|
220
|
+
text: 'You voted · Pay down debt',
|
|
221
|
+
appearance: 'WARNING',
|
|
222
|
+
}),
|
|
223
|
+
),
|
|
224
|
+
],
|
|
225
|
+
}),
|
|
226
|
+
// Result card uses the Card's title prop and stretches to fill
|
|
227
|
+
// the shell's full width because the parent VStack is align:stretch
|
|
228
|
+
SDUI.components.Card({
|
|
229
|
+
title: 'Vote share (mock)',
|
|
230
|
+
padding: '32',
|
|
231
|
+
children: [
|
|
232
|
+
SDUI.components.VStack({
|
|
233
|
+
gap: 'space500',
|
|
234
|
+
align: 'stretch',
|
|
235
|
+
children: [
|
|
236
|
+
SDUI.components.Text({
|
|
237
|
+
typestyle: 'bodyMdEmphasis',
|
|
238
|
+
text: 'Overall mix',
|
|
239
|
+
}),
|
|
240
|
+
SDUI.components.Layout({
|
|
241
|
+
width: '100%',
|
|
242
|
+
padding: { top: 8, bottom: 16 },
|
|
243
|
+
children: [
|
|
244
|
+
SDUI.components.DistributionBar({
|
|
245
|
+
segments: POLL_SEGMENTS,
|
|
246
|
+
totalValue: POLL_TOTAL,
|
|
247
|
+
size: 'standard',
|
|
248
|
+
}),
|
|
249
|
+
],
|
|
250
|
+
}),
|
|
251
|
+
SDUI.components.Text({
|
|
252
|
+
typestyle: 'bodyMdEmphasis',
|
|
253
|
+
text: 'Each option',
|
|
254
|
+
}),
|
|
255
|
+
SDUI.components.VStack({
|
|
256
|
+
gap: 'space400',
|
|
257
|
+
children: [
|
|
258
|
+
SDUI.components.ProgressBar({
|
|
259
|
+
value: PCT_V,
|
|
260
|
+
label: 'Ship faster',
|
|
261
|
+
appearance: 'PRIMARY',
|
|
262
|
+
showPercentage: true,
|
|
263
|
+
}),
|
|
264
|
+
SDUI.components.ProgressBar({
|
|
265
|
+
value: PCT_Q,
|
|
266
|
+
label: 'Raise quality',
|
|
267
|
+
appearance: 'SUCCESS',
|
|
268
|
+
showPercentage: true,
|
|
269
|
+
}),
|
|
270
|
+
SDUI.components.ProgressBar({
|
|
271
|
+
value: PCT_D,
|
|
272
|
+
label: 'Pay down debt',
|
|
273
|
+
appearance: 'WARNING',
|
|
274
|
+
showPercentage: true,
|
|
275
|
+
}),
|
|
276
|
+
],
|
|
277
|
+
}),
|
|
278
|
+
SDUI.components.Text({
|
|
279
|
+
align: 'center',
|
|
280
|
+
typestyle: 'bodySm',
|
|
281
|
+
color: 'secondary',
|
|
282
|
+
text: 'Hook callFunction to replace mock totals.',
|
|
283
|
+
}),
|
|
284
|
+
],
|
|
285
|
+
}),
|
|
286
|
+
],
|
|
287
|
+
}),
|
|
288
|
+
],
|
|
289
|
+
}),
|
|
290
|
+
),
|
|
291
|
+
],
|
|
292
|
+
}),
|
|
293
|
+
],
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
const root = SDUI.components.VStack({
|
|
297
|
+
align: 'stretch',
|
|
298
|
+
gap: 'space0',
|
|
299
|
+
children: [shell],
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
return SDUI.render(s, root);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export async function onRipplingEvent(
|
|
306
|
+
event: FunctionEvent,
|
|
307
|
+
context: FunctionContext,
|
|
308
|
+
): Promise<FunctionResponse> {
|
|
309
|
+
const params = event['parameters'] as Record<string, string | undefined> | undefined;
|
|
310
|
+
const action = params?.['action'];
|
|
311
|
+
|
|
312
|
+
if (!action || action === 'init') {
|
|
313
|
+
const spec = renderSpec(context.function?.function_id ?? 'demo-fn');
|
|
314
|
+
return new FunctionResponse({
|
|
315
|
+
body: { spec: JSON.stringify(spec) },
|
|
316
|
+
statusCode: 200,
|
|
317
|
+
headers: {},
|
|
318
|
+
message: '',
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
return new FunctionResponse({
|
|
323
|
+
body: {},
|
|
324
|
+
statusCode: 200,
|
|
325
|
+
headers: {},
|
|
326
|
+
message: '',
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
*/
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One-screen team poll: pick a priority → see a colored breakdown (preview totals).
|
|
3
|
+
* No tabs, no Custom Objects. Run:
|
|
4
|
+
* npx ts-node --transpile-only -r tsconfig-paths/register examples/sdui/vote/vote.ts
|
|
5
|
+
*/
|
|
6
|
+
import SDUI from '../../../src/lib/sdui';
|
|
7
|
+
|
|
8
|
+
// Whole-number percentages that sum to 100 — matches what DistributionBar
|
|
9
|
+
// and ProgressBar both expect, so they tell the same visual story.
|
|
10
|
+
const PCT_V = 52;
|
|
11
|
+
const PCT_Q = 33;
|
|
12
|
+
const PCT_D = 15;
|
|
13
|
+
const POLL_TOTAL = PCT_V + PCT_Q + PCT_D;
|
|
14
|
+
|
|
15
|
+
const POLL_SEGMENTS = [
|
|
16
|
+
{ value: PCT_V, segmentColor: '#4F46E5' },
|
|
17
|
+
{ value: PCT_Q, segmentColor: '#059669' },
|
|
18
|
+
{ value: PCT_D, segmentColor: '#EA580C' },
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
function renderSpec(_functionId: string) {
|
|
22
|
+
const s = SDUI.createState({
|
|
23
|
+
voteChoice: '',
|
|
24
|
+
resultsVisible: false,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// Vote cards: every card gets the same explicit width: '33%' so they're
|
|
28
|
+
// mathematically equal regardless of content length. justify 'space-between'
|
|
29
|
+
// is a real CSS value (unlike 'stretch') so layout actually applies.
|
|
30
|
+
const voteCards = SDUI.components.HStack({
|
|
31
|
+
gap: 'space500',
|
|
32
|
+
wrap: false,
|
|
33
|
+
justify: 'space-between',
|
|
34
|
+
align: 'stretch',
|
|
35
|
+
children: [
|
|
36
|
+
SDUI.components.Layout({
|
|
37
|
+
width: '33%',
|
|
38
|
+
children: [
|
|
39
|
+
SDUI.components.Card({
|
|
40
|
+
title: 'Ship faster',
|
|
41
|
+
padding: '32',
|
|
42
|
+
children: [
|
|
43
|
+
SDUI.components.VStack({
|
|
44
|
+
gap: 'space500',
|
|
45
|
+
align: 'stretch',
|
|
46
|
+
children: [
|
|
47
|
+
SDUI.components.Text({
|
|
48
|
+
text: 'More releases, shorter cycles.',
|
|
49
|
+
typestyle: 'bodyLg',
|
|
50
|
+
color: 'secondary',
|
|
51
|
+
}),
|
|
52
|
+
SDUI.components.Button({
|
|
53
|
+
label: 'Vote',
|
|
54
|
+
appearance: 'PRIMARY',
|
|
55
|
+
size: 'L',
|
|
56
|
+
onPress: [
|
|
57
|
+
SDUI.actions.set(s.voteChoice, 'velocity'),
|
|
58
|
+
SDUI.actions.set(s.resultsVisible, true),
|
|
59
|
+
],
|
|
60
|
+
}),
|
|
61
|
+
],
|
|
62
|
+
}),
|
|
63
|
+
],
|
|
64
|
+
}),
|
|
65
|
+
],
|
|
66
|
+
}),
|
|
67
|
+
SDUI.components.Layout({
|
|
68
|
+
width: '33%',
|
|
69
|
+
children: [
|
|
70
|
+
SDUI.components.Card({
|
|
71
|
+
title: 'Raise quality',
|
|
72
|
+
padding: '32',
|
|
73
|
+
children: [
|
|
74
|
+
SDUI.components.VStack({
|
|
75
|
+
gap: 'space500',
|
|
76
|
+
align: 'stretch',
|
|
77
|
+
children: [
|
|
78
|
+
SDUI.components.Text({
|
|
79
|
+
text: 'Fewer bugs, better UX.',
|
|
80
|
+
typestyle: 'bodyLg',
|
|
81
|
+
color: 'secondary',
|
|
82
|
+
}),
|
|
83
|
+
SDUI.components.Button({
|
|
84
|
+
label: 'Vote',
|
|
85
|
+
appearance: 'SUCCESS',
|
|
86
|
+
size: 'L',
|
|
87
|
+
onPress: [
|
|
88
|
+
SDUI.actions.set(s.voteChoice, 'quality'),
|
|
89
|
+
SDUI.actions.set(s.resultsVisible, true),
|
|
90
|
+
],
|
|
91
|
+
}),
|
|
92
|
+
],
|
|
93
|
+
}),
|
|
94
|
+
],
|
|
95
|
+
}),
|
|
96
|
+
],
|
|
97
|
+
}),
|
|
98
|
+
SDUI.components.Layout({
|
|
99
|
+
width: '33%',
|
|
100
|
+
children: [
|
|
101
|
+
SDUI.components.Card({
|
|
102
|
+
title: 'Pay down debt',
|
|
103
|
+
padding: '32',
|
|
104
|
+
children: [
|
|
105
|
+
SDUI.components.VStack({
|
|
106
|
+
gap: 'space500',
|
|
107
|
+
align: 'stretch',
|
|
108
|
+
children: [
|
|
109
|
+
SDUI.components.Text({
|
|
110
|
+
text: 'Refactors and infra.',
|
|
111
|
+
typestyle: 'bodyLg',
|
|
112
|
+
color: 'secondary',
|
|
113
|
+
}),
|
|
114
|
+
SDUI.components.Button({
|
|
115
|
+
label: 'Vote',
|
|
116
|
+
appearance: 'WARNING',
|
|
117
|
+
size: 'L',
|
|
118
|
+
onPress: [
|
|
119
|
+
SDUI.actions.set(s.voteChoice, 'debt'),
|
|
120
|
+
SDUI.actions.set(s.resultsVisible, true),
|
|
121
|
+
],
|
|
122
|
+
}),
|
|
123
|
+
],
|
|
124
|
+
}),
|
|
125
|
+
],
|
|
126
|
+
}),
|
|
127
|
+
],
|
|
128
|
+
}),
|
|
129
|
+
],
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
const shell = SDUI.components.Layout({
|
|
133
|
+
width: '100%',
|
|
134
|
+
maxWidth: '1200px',
|
|
135
|
+
margin: { left: 'auto', right: 'auto' },
|
|
136
|
+
padding: { top: 48, bottom: 56, left: 32, right: 32 },
|
|
137
|
+
children: [
|
|
138
|
+
SDUI.components.VStack({
|
|
139
|
+
gap: 'space700',
|
|
140
|
+
align: 'stretch',
|
|
141
|
+
children: [
|
|
142
|
+
SDUI.components.VStack({
|
|
143
|
+
gap: 'space300',
|
|
144
|
+
align: 'center',
|
|
145
|
+
children: [
|
|
146
|
+
SDUI.components.Heading({
|
|
147
|
+
level: '1',
|
|
148
|
+
align: 'center',
|
|
149
|
+
text: 'Where should we focus next quarter?',
|
|
150
|
+
}),
|
|
151
|
+
SDUI.components.Text({
|
|
152
|
+
align: 'center',
|
|
153
|
+
maxWidth: '680px',
|
|
154
|
+
text: 'One vote. Percentages are mock data — swap in real counts later.',
|
|
155
|
+
typestyle: 'bodyLg',
|
|
156
|
+
color: 'secondary',
|
|
157
|
+
}),
|
|
158
|
+
],
|
|
159
|
+
}),
|
|
160
|
+
SDUI.components.Divider({}),
|
|
161
|
+
voteCards,
|
|
162
|
+
SDUI.components.HStack({
|
|
163
|
+
gap: 'space300',
|
|
164
|
+
justify: 'center',
|
|
165
|
+
wrap: true,
|
|
166
|
+
children: [
|
|
167
|
+
SDUI.components.Chip({
|
|
168
|
+
text: 'Start over',
|
|
169
|
+
appearance: 'NEUTRAL',
|
|
170
|
+
onPress: [SDUI.actions.set(s.voteChoice, ''), SDUI.actions.set(s.resultsVisible, false)],
|
|
171
|
+
}),
|
|
172
|
+
],
|
|
173
|
+
}),
|
|
174
|
+
SDUI.visible(
|
|
175
|
+
SDUI.conditions.falsy(s.resultsVisible),
|
|
176
|
+
SDUI.components.Text({
|
|
177
|
+
align: 'center',
|
|
178
|
+
maxWidth: '560px',
|
|
179
|
+
typestyle: 'bodyMd',
|
|
180
|
+
color: 'secondary',
|
|
181
|
+
text: 'Tap Vote — results open below with a split bar plus one bar per option.',
|
|
182
|
+
}),
|
|
183
|
+
),
|
|
184
|
+
SDUI.visible(
|
|
185
|
+
SDUI.conditions.truthy(s.resultsVisible),
|
|
186
|
+
SDUI.components.VStack({
|
|
187
|
+
gap: 'space500',
|
|
188
|
+
align: 'stretch',
|
|
189
|
+
children: [
|
|
190
|
+
// The "you voted" badge sits centered above the result card
|
|
191
|
+
SDUI.components.HStack({
|
|
192
|
+
gap: 'space200',
|
|
193
|
+
justify: 'center',
|
|
194
|
+
wrap: true,
|
|
195
|
+
children: [
|
|
196
|
+
SDUI.visible(
|
|
197
|
+
SDUI.conditions.eq(s.voteChoice, 'velocity'),
|
|
198
|
+
SDUI.components.Badge({
|
|
199
|
+
text: 'You voted · Ship faster',
|
|
200
|
+
appearance: 'PRIMARY',
|
|
201
|
+
}),
|
|
202
|
+
),
|
|
203
|
+
SDUI.visible(
|
|
204
|
+
SDUI.conditions.eq(s.voteChoice, 'quality'),
|
|
205
|
+
SDUI.components.Badge({
|
|
206
|
+
text: 'You voted · Raise quality',
|
|
207
|
+
appearance: 'SUCCESS',
|
|
208
|
+
}),
|
|
209
|
+
),
|
|
210
|
+
SDUI.visible(
|
|
211
|
+
SDUI.conditions.eq(s.voteChoice, 'debt'),
|
|
212
|
+
SDUI.components.Badge({
|
|
213
|
+
text: 'You voted · Pay down debt',
|
|
214
|
+
appearance: 'WARNING',
|
|
215
|
+
}),
|
|
216
|
+
),
|
|
217
|
+
],
|
|
218
|
+
}),
|
|
219
|
+
// Result card uses the Card's title prop and stretches to fill
|
|
220
|
+
// the shell's full width because the parent VStack is align:stretch
|
|
221
|
+
SDUI.components.Card({
|
|
222
|
+
title: 'Vote share (mock)',
|
|
223
|
+
padding: '32',
|
|
224
|
+
children: [
|
|
225
|
+
SDUI.components.VStack({
|
|
226
|
+
gap: 'space500',
|
|
227
|
+
align: 'stretch',
|
|
228
|
+
children: [
|
|
229
|
+
SDUI.components.Text({
|
|
230
|
+
typestyle: 'bodyMdEmphasis',
|
|
231
|
+
text: 'Overall mix',
|
|
232
|
+
}),
|
|
233
|
+
SDUI.components.Layout({
|
|
234
|
+
width: '100%',
|
|
235
|
+
padding: { top: 8, bottom: 16 },
|
|
236
|
+
children: [
|
|
237
|
+
SDUI.components.DistributionBar({
|
|
238
|
+
segments: POLL_SEGMENTS,
|
|
239
|
+
totalValue: POLL_TOTAL,
|
|
240
|
+
size: 'standard',
|
|
241
|
+
}),
|
|
242
|
+
],
|
|
243
|
+
}),
|
|
244
|
+
SDUI.components.Text({
|
|
245
|
+
typestyle: 'bodyMdEmphasis',
|
|
246
|
+
text: 'Each option',
|
|
247
|
+
}),
|
|
248
|
+
SDUI.components.VStack({
|
|
249
|
+
gap: 'space400',
|
|
250
|
+
children: [
|
|
251
|
+
SDUI.components.ProgressBar({
|
|
252
|
+
value: PCT_V,
|
|
253
|
+
label: 'Ship faster',
|
|
254
|
+
appearance: 'PRIMARY',
|
|
255
|
+
showPercentage: true,
|
|
256
|
+
}),
|
|
257
|
+
SDUI.components.ProgressBar({
|
|
258
|
+
value: PCT_Q,
|
|
259
|
+
label: 'Raise quality',
|
|
260
|
+
appearance: 'SUCCESS',
|
|
261
|
+
showPercentage: true,
|
|
262
|
+
}),
|
|
263
|
+
SDUI.components.ProgressBar({
|
|
264
|
+
value: PCT_D,
|
|
265
|
+
label: 'Pay down debt',
|
|
266
|
+
appearance: 'WARNING',
|
|
267
|
+
showPercentage: true,
|
|
268
|
+
}),
|
|
269
|
+
],
|
|
270
|
+
}),
|
|
271
|
+
SDUI.components.Text({
|
|
272
|
+
align: 'center',
|
|
273
|
+
typestyle: 'bodySm',
|
|
274
|
+
color: 'secondary',
|
|
275
|
+
text: 'Hook callFunction to replace mock totals.',
|
|
276
|
+
}),
|
|
277
|
+
],
|
|
278
|
+
}),
|
|
279
|
+
],
|
|
280
|
+
}),
|
|
281
|
+
],
|
|
282
|
+
}),
|
|
283
|
+
),
|
|
284
|
+
],
|
|
285
|
+
}),
|
|
286
|
+
],
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
const root = SDUI.components.VStack({
|
|
290
|
+
align: 'stretch',
|
|
291
|
+
gap: 'space0',
|
|
292
|
+
children: [shell],
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
return SDUI.render(s, root);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
console.log(JSON.stringify(renderSpec('demo-fn'), null, 2));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.d.mts","sourceRoot":"","sources":["../../src/internal/utils/log.ts"],"names":[],"mappings":"OAGO,EAAE,KAAK,WAAW,EAAE;OACpB,EAAE,cAAc,EAAE;AAEzB,KAAK,KAAK,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;AAC3D,M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MAAM,CAsBrD;AAED,eAAO,MAAM,oBAAoB,GAAI,SAAS;IAC5C,OAAO,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;IACrC,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;IACvD,mBAAmB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;cAVW,cAAc,GAAG,SAAS;cAC1B,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS;0BAChC,MAAM,GAAG,SAAS;cAC9B,MAAM,GAAG,SAAS;UACtB,MAAM,GAAG,SAAS;aACf,MAAM,GAAG,SAAS;aAClB,MAAM,GAAG,SAAS;iBACd,MAAM,GAAG,SAAS;cACrB,OAAO;WACV,OAAO;CA+Bf,CAAC"}
|
package/internal/utils/log.js
CHANGED
|
@@ -67,6 +67,8 @@ const formatRequestDetails = (details) => {
|
|
|
67
67
|
details.headers = Object.fromEntries((details.headers instanceof Headers ? [...details.headers] : Object.entries(details.headers)).map(([name, value]) => [
|
|
68
68
|
name,
|
|
69
69
|
(name.toLowerCase() === 'authorization' ||
|
|
70
|
+
name.toLowerCase() === 'api-key' ||
|
|
71
|
+
name.toLowerCase() === 'x-api-key' ||
|
|
70
72
|
name.toLowerCase() === 'cookie' ||
|
|
71
73
|
name.toLowerCase() === 'set-cookie') ?
|
|
72
74
|
'***'
|
|
@@ -1 +1 @@
|
|
|
1
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IAAI,CAAC,WAAW,EAAE,KAAK,YAAY,CACpC,CAAC,CAAC;gBACD,KAAK;gBACP,CAAC,CAAC,KAAK;SACR,CACF,CACF,CAAC;IACJ,CAAC;IACD,IAAI,qBAAqB,IAAI,OAAO,EAAE,CAAC;QACrC,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC;YAChC,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC;QAChD,CAAC;QACD,OAAO,OAAO,CAAC,mBAAmB,CAAC;IACrC,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAzCW,QAAA,oBAAoB,wBAyC/B"}
|
package/internal/utils/log.mjs
CHANGED
|
@@ -62,6 +62,8 @@ export const formatRequestDetails = (details) => {
|
|
|
62
62
|
details.headers = Object.fromEntries((details.headers instanceof Headers ? [...details.headers] : Object.entries(details.headers)).map(([name, value]) => [
|
|
63
63
|
name,
|
|
64
64
|
(name.toLowerCase() === 'authorization' ||
|
|
65
|
+
name.toLowerCase() === 'api-key' ||
|
|
66
|
+
name.toLowerCase() === 'x-api-key' ||
|
|
65
67
|
name.toLowerCase() === 'cookie' ||
|
|
66
68
|
name.toLowerCase() === 'set-cookie') ?
|
|
67
69
|
'***'
|