@rippling/rippling-sdk 0.2.0-alpha.59 → 0.2.0-alpha.61

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 (138) hide show
  1. package/examples/manifest/dental-practice-management/dental-practice-management.ts +10 -10
  2. package/examples/manifest/dental-practice-management/functions/chair-schedule.ts +7 -10
  3. package/examples/manifest/dental-practice-management/functions/operatory-list.ts +7 -10
  4. package/examples/manifest/dental-practice-management/functions/patient-list.ts +7 -10
  5. package/examples/manifest/dental-practice-management/functions/treatment-plan-list.ts +7 -10
  6. package/examples/manifest/gym-membership-management/functions/check-in-desk.ts +7 -10
  7. package/examples/manifest/gym-membership-management/functions/member-list.ts +7 -10
  8. package/examples/manifest/gym-membership-management/functions/today-schedule.ts +7 -10
  9. package/examples/manifest/gym-membership-management/functions/trainer-list.ts +7 -10
  10. package/examples/manifest/gym-membership-management/gym-membership-management.ts +10 -10
  11. package/examples/manifest/simple-todo-app/functions/todo-list.ts +7 -10
  12. package/examples/manifest/simple-todo-app/simple-todo-app.ts +3 -5
  13. package/internal/tslib.js +0 -4
  14. package/lib/manifest/index.d.mts +1 -1
  15. package/lib/manifest/index.d.mts.map +1 -1
  16. package/lib/manifest/index.d.ts +1 -1
  17. package/lib/manifest/index.d.ts.map +1 -1
  18. package/lib/manifest/index.js.map +1 -1
  19. package/lib/manifest/index.mjs.map +1 -1
  20. package/lib/manifest/manifest-function.d.mts +10 -7
  21. package/lib/manifest/manifest-function.d.mts.map +1 -1
  22. package/lib/manifest/manifest-function.d.ts +10 -7
  23. package/lib/manifest/manifest-function.d.ts.map +1 -1
  24. package/lib/manifest/manifest-function.js +14 -10
  25. package/lib/manifest/manifest-function.js.map +1 -1
  26. package/lib/manifest/manifest-function.mjs +13 -10
  27. package/lib/manifest/manifest-function.mjs.map +1 -1
  28. package/package.json +1 -1
  29. package/src/lib/manifest/index.ts +1 -0
  30. package/src/lib/manifest/manifest-function.ts +21 -11
  31. package/src/version.ts +1 -1
  32. package/version.d.mts +1 -1
  33. package/version.d.ts +1 -1
  34. package/version.js +1 -1
  35. package/version.mjs +1 -1
  36. package/examples/sdui/sdui-crud-todo/rippling-function.ts +0 -358
  37. package/examples/sdui/sdui-showcase/rippling-function.ts +0 -366
  38. package/examples/sdui/sdui-tab-multi-view/rippling-function.ts +0 -1042
  39. package/examples/sdui/vote/rippling-function.ts +0 -315
  40. package/lib/sdui/actions.d.mts +0 -25
  41. package/lib/sdui/actions.d.mts.map +0 -1
  42. package/lib/sdui/actions.d.ts +0 -25
  43. package/lib/sdui/actions.d.ts.map +0 -1
  44. package/lib/sdui/actions.js +0 -63
  45. package/lib/sdui/actions.js.map +0 -1
  46. package/lib/sdui/actions.mjs +0 -52
  47. package/lib/sdui/actions.mjs.map +0 -1
  48. package/lib/sdui/component.d.mts +0 -58
  49. package/lib/sdui/component.d.mts.map +0 -1
  50. package/lib/sdui/component.d.ts +0 -58
  51. package/lib/sdui/component.d.ts.map +0 -1
  52. package/lib/sdui/component.js +0 -128
  53. package/lib/sdui/component.js.map +0 -1
  54. package/lib/sdui/component.mjs +0 -124
  55. package/lib/sdui/component.mjs.map +0 -1
  56. package/lib/sdui/components.d.mts +0 -1047
  57. package/lib/sdui/components.d.mts.map +0 -1
  58. package/lib/sdui/components.d.ts +0 -1047
  59. package/lib/sdui/components.d.ts.map +0 -1
  60. package/lib/sdui/components.js +0 -845
  61. package/lib/sdui/components.js.map +0 -1
  62. package/lib/sdui/components.mjs +0 -840
  63. package/lib/sdui/components.mjs.map +0 -1
  64. package/lib/sdui/conditions.d.mts +0 -25
  65. package/lib/sdui/conditions.d.mts.map +0 -1
  66. package/lib/sdui/conditions.d.ts +0 -25
  67. package/lib/sdui/conditions.d.ts.map +0 -1
  68. package/lib/sdui/conditions.js +0 -47
  69. package/lib/sdui/conditions.js.map +0 -1
  70. package/lib/sdui/conditions.mjs +0 -35
  71. package/lib/sdui/conditions.mjs.map +0 -1
  72. package/lib/sdui/directives.d.mts +0 -18
  73. package/lib/sdui/directives.d.mts.map +0 -1
  74. package/lib/sdui/directives.d.ts +0 -18
  75. package/lib/sdui/directives.d.ts.map +0 -1
  76. package/lib/sdui/directives.js +0 -31
  77. package/lib/sdui/directives.js.map +0 -1
  78. package/lib/sdui/directives.mjs +0 -24
  79. package/lib/sdui/directives.mjs.map +0 -1
  80. package/lib/sdui/index.d.mts +0 -375
  81. package/lib/sdui/index.d.mts.map +0 -1
  82. package/lib/sdui/index.d.ts +0 -375
  83. package/lib/sdui/index.d.ts.map +0 -1
  84. package/lib/sdui/index.js +0 -386
  85. package/lib/sdui/index.js.map +0 -1
  86. package/lib/sdui/index.mjs +0 -215
  87. package/lib/sdui/index.mjs.map +0 -1
  88. package/lib/sdui/propTypes.d.mts +0 -5971
  89. package/lib/sdui/propTypes.d.mts.map +0 -1
  90. package/lib/sdui/propTypes.d.ts +0 -5971
  91. package/lib/sdui/propTypes.d.ts.map +0 -1
  92. package/lib/sdui/propTypes.js +0 -14
  93. package/lib/sdui/propTypes.js.map +0 -1
  94. package/lib/sdui/propTypes.mjs +0 -13
  95. package/lib/sdui/propTypes.mjs.map +0 -1
  96. package/lib/sdui/props.d.mts +0 -12
  97. package/lib/sdui/props.d.mts.map +0 -1
  98. package/lib/sdui/props.d.ts +0 -12
  99. package/lib/sdui/props.d.ts.map +0 -1
  100. package/lib/sdui/props.js +0 -25
  101. package/lib/sdui/props.js.map +0 -1
  102. package/lib/sdui/props.mjs +0 -21
  103. package/lib/sdui/props.mjs.map +0 -1
  104. package/lib/sdui/render.d.mts +0 -23
  105. package/lib/sdui/render.d.mts.map +0 -1
  106. package/lib/sdui/render.d.ts +0 -23
  107. package/lib/sdui/render.d.ts.map +0 -1
  108. package/lib/sdui/render.js +0 -48
  109. package/lib/sdui/render.js.map +0 -1
  110. package/lib/sdui/render.mjs +0 -45
  111. package/lib/sdui/render.mjs.map +0 -1
  112. package/lib/sdui/state.d.mts +0 -22
  113. package/lib/sdui/state.d.mts.map +0 -1
  114. package/lib/sdui/state.d.ts +0 -22
  115. package/lib/sdui/state.d.ts.map +0 -1
  116. package/lib/sdui/state.js +0 -59
  117. package/lib/sdui/state.js.map +0 -1
  118. package/lib/sdui/state.mjs +0 -55
  119. package/lib/sdui/state.mjs.map +0 -1
  120. package/lib/sdui.d.mts +0 -3
  121. package/lib/sdui.d.mts.map +0 -1
  122. package/lib/sdui.d.ts +0 -3
  123. package/lib/sdui.d.ts.map +0 -1
  124. package/lib/sdui.js +0 -8
  125. package/lib/sdui.js.map +0 -1
  126. package/lib/sdui.mjs +0 -3
  127. package/lib/sdui.mjs.map +0 -1
  128. package/src/lib/sdui/actions.ts +0 -71
  129. package/src/lib/sdui/component.ts +0 -162
  130. package/src/lib/sdui/components.ts +0 -1572
  131. package/src/lib/sdui/conditions.ts +0 -59
  132. package/src/lib/sdui/directives.ts +0 -45
  133. package/src/lib/sdui/index.ts +0 -650
  134. package/src/lib/sdui/propTypes.ts +0 -8087
  135. package/src/lib/sdui/props.ts +0 -32
  136. package/src/lib/sdui/render.ts +0 -66
  137. package/src/lib/sdui/state.ts +0 -66
  138. package/src/lib/sdui.ts +0 -2
@@ -1,358 +0,0 @@
1
- /** Todo CRUD demo: grid + modals wired to create / update / delete via callFunction. Mock data only. */
2
-
3
- import SDUI from '@rippling/rippling-sdk/lib/sdui';
4
- import { FunctionContext, FunctionEvent, FunctionResponse } from '@rippling/rippling-sdk';
5
-
6
- const INITIAL_TODOS = [
7
- {
8
- id: 't1',
9
- _key: 't1',
10
- title__c: 'Ship SDK patch',
11
- status__c: 'In Progress',
12
- priority__c: 'High',
13
- notes__c: 'Regression pass on SDUI examples',
14
- },
15
- {
16
- id: 't2',
17
- _key: 't2',
18
- title__c: 'Document Function paste flow',
19
- status__c: 'To Do',
20
- priority__c: 'Medium',
21
- notes__c: 'Caps comment on rippling-function.ts',
22
- },
23
- {
24
- id: 't3',
25
- _key: 't3',
26
- title__c: 'Weekly sync',
27
- status__c: 'Done',
28
- priority__c: 'Low',
29
- notes__c: '',
30
- },
31
- ];
32
-
33
- let mutableTodos = INITIAL_TODOS.map((r) => ({ ...r }));
34
-
35
- function renderSpec(functionId: string) {
36
- const s = SDUI.createState({
37
- todos: mutableTodos,
38
- selectedRow: null as unknown,
39
- showCreateModal: false,
40
- showEditModal: false,
41
- form: { title: '', status: '', priority: '', notes: '' },
42
- });
43
-
44
- const mainColumn = SDUI.components.VStack({
45
- gap: 'space500',
46
- children: [
47
- SDUI.components.VStack({
48
- gap: 'space300',
49
- children: [
50
- SDUI.components.HStack({
51
- gap: 'space200',
52
- align: 'center',
53
- wrap: 'wrap',
54
- children: [
55
- SDUI.components.Heading({
56
- level: 2,
57
- text: 'Team todos',
58
- }),
59
- SDUI.components.Badge({
60
- text: 'Demo data',
61
- appearance: 'NEUTRAL',
62
- size: 'S',
63
- }),
64
- ],
65
- }),
66
- SDUI.components.Text({
67
- text: 'Create, edit, and delete call this Function; the grid below uses sample rows until you connect Custom Objects or your own API.',
68
- typestyle: 'bodyMd',
69
- color: 'secondary',
70
- maxWidth: '720px',
71
- }),
72
- ],
73
- }),
74
- SDUI.components.Layout({
75
- width: '100%',
76
- children: [SDUI.components.Divider({})],
77
- }),
78
- SDUI.components.Grid({
79
- data: s.todos,
80
- columns: [
81
- { id: 'title__c', header: 'Title', data: 'title__c' },
82
- { id: 'status__c', header: 'Status', data: 'status__c', type: 'text' },
83
- { id: 'priority__c', header: 'Priority', data: 'priority__c', type: 'text' },
84
- { id: 'notes__c', header: 'Notes', data: 'notes__c' },
85
- ],
86
- selectedRow: s.selectedRow.$bind,
87
- headerActions: [{ id: 'new', label: 'New Todo', icon: 'ADD', appearance: 'primary' }],
88
- onHeaderAction: [
89
- SDUI.actions.set(s.form, { title: '', status: '', priority: '', notes: '' }),
90
- SDUI.actions.set(s.showCreateModal, true),
91
- ],
92
- rowActions: [
93
- { id: 'edit', label: 'Edit', icon: 'EDIT_OUTLINE', placement: 'menu' },
94
- { id: 'delete', label: 'Delete', icon: 'TRASH_OUTLINE', placement: 'menu' },
95
- ],
96
- onRowAction: [
97
- SDUI.actions.set(s.form, {
98
- title: s.selectedRow['title__c'],
99
- status: s.selectedRow['status__c'],
100
- priority: s.selectedRow['priority__c'],
101
- notes: s.selectedRow['notes__c'],
102
- }),
103
- SDUI.actions.set(s.showEditModal, true),
104
- ],
105
- onRowClick: [
106
- SDUI.actions.set(s.form, {
107
- title: s.selectedRow['title__c'],
108
- status: s.selectedRow['status__c'],
109
- priority: s.selectedRow['priority__c'],
110
- notes: s.selectedRow['notes__c'],
111
- }),
112
- SDUI.actions.set(s.showEditModal, true),
113
- ],
114
- }),
115
- ],
116
- });
117
-
118
- const root = SDUI.components.VStack({
119
- align: 'center',
120
- gap: 'space0',
121
- children: [
122
- SDUI.components.Layout({
123
- maxWidth: '1080px',
124
- width: '100%',
125
- margin: { left: 'auto', right: 'auto' },
126
- padding: { top: 32, bottom: 40, left: 24, right: 24 },
127
- children: [mainColumn],
128
- }),
129
-
130
- SDUI.components.Modal({
131
- title: 'New Todo',
132
- isOpen: s.showCreateModal.$bind,
133
- onClose: SDUI.actions.set(s.showCreateModal, false),
134
- children: [
135
- SDUI.components.VStack({
136
- gap: 'space300',
137
- children: [
138
- SDUI.components.TextInput({
139
- label: 'Title',
140
- name: 'title',
141
- value: s.form.title.$bind,
142
- isRequired: true,
143
- }),
144
- SDUI.components.Select({
145
- label: 'Status',
146
- name: 'status',
147
- value: s.form.status.$bind,
148
- options: [
149
- { label: 'To Do', value: 'To Do' },
150
- { label: 'In Progress', value: 'In Progress' },
151
- { label: 'Done', value: 'Done' },
152
- ],
153
- }),
154
- SDUI.components.Select({
155
- label: 'Priority',
156
- name: 'priority',
157
- value: s.form.priority.$bind,
158
- options: [
159
- { label: 'Low', value: 'Low' },
160
- { label: 'Medium', value: 'Medium' },
161
- { label: 'High', value: 'High' },
162
- ],
163
- }),
164
- SDUI.components.Textarea({
165
- label: 'Notes',
166
- name: 'notes',
167
- value: s.form.notes.$bind,
168
- }),
169
- ],
170
- }),
171
- SDUI.components.HStack({
172
- gap: 'space200',
173
- justify: 'flex-end',
174
- children: [
175
- SDUI.components.Button({
176
- label: 'Cancel',
177
- appearance: 'OUTLINE',
178
- onPress: SDUI.actions.set(s.showCreateModal, false),
179
- }),
180
- SDUI.components.Button({
181
- label: 'Create',
182
- appearance: 'PRIMARY',
183
- onPress: SDUI.actions.callFunction(functionId, 'create', {
184
- title: s.form.title,
185
- status: s.form.status,
186
- priority: s.form.priority,
187
- notes: s.form.notes,
188
- responsePath: '/todos',
189
- onSuccess: { set: { '/showCreateModal': false } },
190
- }),
191
- }),
192
- ],
193
- }),
194
- ],
195
- }),
196
-
197
- SDUI.components.Modal({
198
- title: 'Edit Todo',
199
- isOpen: s.showEditModal.$bind,
200
- onClose: SDUI.actions.set(s.showEditModal, false),
201
- children: [
202
- SDUI.components.VStack({
203
- gap: 'space300',
204
- children: [
205
- SDUI.components.TextInput({
206
- label: 'Title',
207
- name: 'edit_title',
208
- value: s.form.title.$bind,
209
- isRequired: true,
210
- }),
211
- SDUI.components.Select({
212
- label: 'Status',
213
- name: 'edit_status',
214
- value: s.form.status.$bind,
215
- options: [
216
- { label: 'To Do', value: 'To Do' },
217
- { label: 'In Progress', value: 'In Progress' },
218
- { label: 'Done', value: 'Done' },
219
- ],
220
- }),
221
- SDUI.components.Select({
222
- label: 'Priority',
223
- name: 'edit_priority',
224
- value: s.form.priority.$bind,
225
- options: [
226
- { label: 'Low', value: 'Low' },
227
- { label: 'Medium', value: 'Medium' },
228
- { label: 'High', value: 'High' },
229
- ],
230
- }),
231
- SDUI.components.Textarea({
232
- label: 'Notes',
233
- name: 'edit_notes',
234
- value: s.form.notes.$bind,
235
- }),
236
- ],
237
- }),
238
- SDUI.components.HStack({
239
- gap: 'space200',
240
- justify: 'flex-end',
241
- children: [
242
- SDUI.components.Button({
243
- label: 'Delete',
244
- appearance: 'DESTRUCTIVE',
245
- onPress: SDUI.actions.callFunction(functionId, 'delete', {
246
- id: s.selectedRow['id'],
247
- responsePath: '/todos',
248
- onSuccess: { set: { '/showEditModal': false } },
249
- }),
250
- }),
251
- SDUI.components.Button({
252
- label: 'Cancel',
253
- appearance: 'OUTLINE',
254
- onPress: SDUI.actions.set(s.showEditModal, false),
255
- }),
256
- SDUI.components.Button({
257
- label: 'Save',
258
- appearance: 'PRIMARY',
259
- onPress: SDUI.actions.callFunction(functionId, 'update', {
260
- id: s.selectedRow['id'],
261
- title: s.form.title,
262
- status: s.form.status,
263
- priority: s.form.priority,
264
- notes: s.form.notes,
265
- responsePath: '/todos',
266
- onSuccess: { set: { '/showEditModal': false } },
267
- }),
268
- }),
269
- ],
270
- }),
271
- ],
272
- }),
273
- ],
274
- });
275
-
276
- return SDUI.render(s, root);
277
- }
278
-
279
- export async function onRipplingEvent(
280
- event: FunctionEvent,
281
- context: FunctionContext,
282
- ): Promise<FunctionResponse> {
283
- const params = event['parameters'] as Record<string, string | undefined> | undefined;
284
- const action = params?.['action'];
285
- const functionId = context.function?.function_id ?? 'demo-fn';
286
-
287
- if (!action || action === 'init') {
288
- mutableTodos = INITIAL_TODOS.map((r) => ({ ...r }));
289
- const spec = renderSpec(functionId);
290
- return new FunctionResponse({
291
- body: { spec: JSON.stringify(spec) },
292
- statusCode: 200,
293
- headers: {},
294
- message: '',
295
- });
296
- }
297
-
298
- if (action === 'create') {
299
- const p = params ?? {};
300
- const id = `t_${mutableTodos.length + 1}`;
301
- mutableTodos = [
302
- ...mutableTodos,
303
- {
304
- id,
305
- _key: id,
306
- title__c: (p['title'] as string) || 'Untitled',
307
- status__c: (p['status'] as string) || 'To Do',
308
- priority__c: (p['priority'] as string) || 'Medium',
309
- notes__c: (p['notes'] as string) || '',
310
- },
311
- ];
312
- return new FunctionResponse({
313
- body: mutableTodos as unknown as Record<string, unknown>,
314
- statusCode: 200,
315
- headers: {},
316
- message: '',
317
- });
318
- }
319
-
320
- if (action === 'update') {
321
- const p = params ?? {};
322
- mutableTodos = mutableTodos.map((r) =>
323
- r.id === p['id'] ?
324
- {
325
- ...r,
326
- title__c: (p['title'] as string) || r.title__c,
327
- status__c: (p['status'] as string) || r.status__c,
328
- priority__c: (p['priority'] as string) || r.priority__c,
329
- notes__c: (p['notes'] as string) ?? r.notes__c,
330
- }
331
- : r,
332
- );
333
- return new FunctionResponse({
334
- body: mutableTodos as unknown as Record<string, unknown>,
335
- statusCode: 200,
336
- headers: {},
337
- message: '',
338
- });
339
- }
340
-
341
- if (action === 'delete') {
342
- const id = params?.['id'];
343
- mutableTodos = mutableTodos.filter((r) => r.id !== id);
344
- return new FunctionResponse({
345
- body: mutableTodos as unknown as Record<string, unknown>,
346
- statusCode: 200,
347
- headers: {},
348
- message: '',
349
- });
350
- }
351
-
352
- return new FunctionResponse({
353
- body: {},
354
- statusCode: 400,
355
- headers: {},
356
- message: 'Unknown action',
357
- });
358
- }