dhisana 0.0.1.dev243__py3-none-any.whl
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.
- dhisana/__init__.py +1 -0
- dhisana/cli/__init__.py +1 -0
- dhisana/cli/cli.py +20 -0
- dhisana/cli/datasets.py +27 -0
- dhisana/cli/models.py +26 -0
- dhisana/cli/predictions.py +20 -0
- dhisana/schemas/__init__.py +1 -0
- dhisana/schemas/common.py +399 -0
- dhisana/schemas/sales.py +965 -0
- dhisana/ui/__init__.py +1 -0
- dhisana/ui/components.py +472 -0
- dhisana/utils/__init__.py +1 -0
- dhisana/utils/add_mapping.py +352 -0
- dhisana/utils/agent_tools.py +51 -0
- dhisana/utils/apollo_tools.py +1597 -0
- dhisana/utils/assistant_tool_tag.py +4 -0
- dhisana/utils/built_with_api_tools.py +282 -0
- dhisana/utils/cache_output_tools.py +98 -0
- dhisana/utils/cache_output_tools_local.py +78 -0
- dhisana/utils/check_email_validity_tools.py +717 -0
- dhisana/utils/check_for_intent_signal.py +107 -0
- dhisana/utils/check_linkedin_url_validity.py +209 -0
- dhisana/utils/clay_tools.py +43 -0
- dhisana/utils/clean_properties.py +135 -0
- dhisana/utils/company_utils.py +60 -0
- dhisana/utils/compose_salesnav_query.py +259 -0
- dhisana/utils/compose_search_query.py +759 -0
- dhisana/utils/compose_three_step_workflow.py +234 -0
- dhisana/utils/composite_tools.py +137 -0
- dhisana/utils/dataframe_tools.py +237 -0
- dhisana/utils/domain_parser.py +45 -0
- dhisana/utils/email_body_utils.py +72 -0
- dhisana/utils/email_parse_helpers.py +132 -0
- dhisana/utils/email_provider.py +375 -0
- dhisana/utils/enrich_lead_information.py +933 -0
- dhisana/utils/extract_email_content_for_llm.py +101 -0
- dhisana/utils/fetch_openai_config.py +129 -0
- dhisana/utils/field_validators.py +426 -0
- dhisana/utils/g2_tools.py +104 -0
- dhisana/utils/generate_content.py +41 -0
- dhisana/utils/generate_custom_message.py +271 -0
- dhisana/utils/generate_email.py +278 -0
- dhisana/utils/generate_email_response.py +465 -0
- dhisana/utils/generate_flow.py +102 -0
- dhisana/utils/generate_leads_salesnav.py +303 -0
- dhisana/utils/generate_linkedin_connect_message.py +224 -0
- dhisana/utils/generate_linkedin_response_message.py +317 -0
- dhisana/utils/generate_structured_output_internal.py +462 -0
- dhisana/utils/google_custom_search.py +267 -0
- dhisana/utils/google_oauth_tools.py +727 -0
- dhisana/utils/google_workspace_tools.py +1294 -0
- dhisana/utils/hubspot_clearbit.py +96 -0
- dhisana/utils/hubspot_crm_tools.py +2440 -0
- dhisana/utils/instantly_tools.py +149 -0
- dhisana/utils/linkedin_crawler.py +168 -0
- dhisana/utils/lusha_tools.py +333 -0
- dhisana/utils/mailgun_tools.py +156 -0
- dhisana/utils/mailreach_tools.py +123 -0
- dhisana/utils/microsoft365_tools.py +455 -0
- dhisana/utils/openai_assistant_and_file_utils.py +267 -0
- dhisana/utils/openai_helpers.py +977 -0
- dhisana/utils/openapi_spec_to_tools.py +45 -0
- dhisana/utils/openapi_tool/__init__.py +1 -0
- dhisana/utils/openapi_tool/api_models.py +633 -0
- dhisana/utils/openapi_tool/convert_openai_spec_to_tool.py +271 -0
- dhisana/utils/openapi_tool/openapi_tool.py +319 -0
- dhisana/utils/parse_linkedin_messages_txt.py +100 -0
- dhisana/utils/profile.py +37 -0
- dhisana/utils/proxy_curl_tools.py +1226 -0
- dhisana/utils/proxycurl_search_leads.py +426 -0
- dhisana/utils/python_function_to_tools.py +83 -0
- dhisana/utils/research_lead.py +176 -0
- dhisana/utils/sales_navigator_crawler.py +1103 -0
- dhisana/utils/salesforce_crm_tools.py +477 -0
- dhisana/utils/search_router.py +131 -0
- dhisana/utils/search_router_jobs.py +51 -0
- dhisana/utils/sendgrid_tools.py +162 -0
- dhisana/utils/serarch_router_local_business.py +75 -0
- dhisana/utils/serpapi_additional_tools.py +290 -0
- dhisana/utils/serpapi_google_jobs.py +117 -0
- dhisana/utils/serpapi_google_search.py +188 -0
- dhisana/utils/serpapi_local_business_search.py +129 -0
- dhisana/utils/serpapi_search_tools.py +852 -0
- dhisana/utils/serperdev_google_jobs.py +125 -0
- dhisana/utils/serperdev_local_business.py +154 -0
- dhisana/utils/serperdev_search.py +233 -0
- dhisana/utils/smtp_email_tools.py +582 -0
- dhisana/utils/test_connect.py +2087 -0
- dhisana/utils/trasform_json.py +173 -0
- dhisana/utils/web_download_parse_tools.py +189 -0
- dhisana/utils/workflow_code_model.py +5 -0
- dhisana/utils/zoominfo_tools.py +357 -0
- dhisana/workflow/__init__.py +1 -0
- dhisana/workflow/agent.py +18 -0
- dhisana/workflow/flow.py +44 -0
- dhisana/workflow/task.py +43 -0
- dhisana/workflow/test.py +90 -0
- dhisana-0.0.1.dev243.dist-info/METADATA +43 -0
- dhisana-0.0.1.dev243.dist-info/RECORD +102 -0
- dhisana-0.0.1.dev243.dist-info/WHEEL +5 -0
- dhisana-0.0.1.dev243.dist-info/entry_points.txt +2 -0
- dhisana-0.0.1.dev243.dist-info/top_level.txt +1 -0
dhisana/ui/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
|
dhisana/ui/components.py
ADDED
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
from typing import List, Dict, Any, Optional, Union
|
|
2
|
+
|
|
3
|
+
class Component:
|
|
4
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
5
|
+
raise NotImplementedError("Must implement to_dict method.")
|
|
6
|
+
|
|
7
|
+
class Header(Component):
|
|
8
|
+
def __init__(self, title: str, subtitle: Optional[str] = None, logo: Optional[str] = None):
|
|
9
|
+
self.title = title
|
|
10
|
+
self.subtitle = subtitle
|
|
11
|
+
self.logo = logo
|
|
12
|
+
|
|
13
|
+
def to_dict(self):
|
|
14
|
+
return {
|
|
15
|
+
'type': 'header',
|
|
16
|
+
'properties': {
|
|
17
|
+
'title': self.title,
|
|
18
|
+
'subtitle': self.subtitle,
|
|
19
|
+
'logo': self.logo,
|
|
20
|
+
},
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
class Footer(Component):
|
|
24
|
+
def __init__(self, content: str):
|
|
25
|
+
self.content = content
|
|
26
|
+
|
|
27
|
+
def to_dict(self):
|
|
28
|
+
return {
|
|
29
|
+
'type': 'footer',
|
|
30
|
+
'properties': {
|
|
31
|
+
'content': self.content,
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
class Sidebar(Component):
|
|
36
|
+
def __init__(self, items: List[str]):
|
|
37
|
+
self.items = items
|
|
38
|
+
|
|
39
|
+
def to_dict(self):
|
|
40
|
+
return {
|
|
41
|
+
'type': 'sidebar',
|
|
42
|
+
'properties': {
|
|
43
|
+
'items': self.items,
|
|
44
|
+
},
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
class MainContent(Component):
|
|
48
|
+
def __init__(self, children: List[Component]):
|
|
49
|
+
self.children = children
|
|
50
|
+
|
|
51
|
+
def to_dict(self):
|
|
52
|
+
return {
|
|
53
|
+
'type': 'main-content',
|
|
54
|
+
'children': [child.to_dict() for child in self.children],
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class ChatWindow(Component):
|
|
59
|
+
def __init__(self, placeholder: str = 'Type your message...', send_button_label: str = 'Send', endpoint_url: str = '/api/chat'):
|
|
60
|
+
self.placeholder = placeholder
|
|
61
|
+
self.send_button_label = send_button_label
|
|
62
|
+
self.endpoint_url = endpoint_url
|
|
63
|
+
|
|
64
|
+
def to_dict(self):
|
|
65
|
+
return {
|
|
66
|
+
'type': 'chat-window',
|
|
67
|
+
'properties': {
|
|
68
|
+
'placeholder': self.placeholder,
|
|
69
|
+
'sendButtonLabel': self.send_button_label,
|
|
70
|
+
'endpointUrl': self.endpoint_url,
|
|
71
|
+
},
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
class DataTable(Component):
|
|
75
|
+
def __init__(
|
|
76
|
+
self,
|
|
77
|
+
columns: List[Dict[str, Any]],
|
|
78
|
+
data_source: str,
|
|
79
|
+
actions: Optional[List[Dict[str, Any]]] = None,
|
|
80
|
+
row_selection: Optional[bool] = False,
|
|
81
|
+
selected_row_keys: Optional[List[str]] = None,
|
|
82
|
+
on_selection_change: Optional[str] = None,
|
|
83
|
+
title: Optional[str] = None,
|
|
84
|
+
):
|
|
85
|
+
self.title = title
|
|
86
|
+
self.columns = columns
|
|
87
|
+
self.data_source = data_source # Should be a reference to data in dataContext
|
|
88
|
+
self.actions = actions or []
|
|
89
|
+
self.row_selection = row_selection
|
|
90
|
+
self.selected_row_keys = selected_row_keys
|
|
91
|
+
self.on_selection_change = on_selection_change
|
|
92
|
+
|
|
93
|
+
def to_dict(self):
|
|
94
|
+
return {
|
|
95
|
+
'type': 'data-table',
|
|
96
|
+
'properties': {
|
|
97
|
+
'title': self.title,
|
|
98
|
+
'columns': self.columns,
|
|
99
|
+
'dataSource': self.data_source, # Should be in the form '{{dataKey}}'
|
|
100
|
+
'actions': self.actions,
|
|
101
|
+
'rowSelection': self.row_selection,
|
|
102
|
+
'selectedRowKeys': self.selected_row_keys,
|
|
103
|
+
'onSelectionChange': self.on_selection_change,
|
|
104
|
+
},
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
class Chart(Component):
|
|
108
|
+
def __init__(self, chart_type: str, data_source: str, options: Optional[Dict[str, Any]] = None):
|
|
109
|
+
self.chart_type = chart_type
|
|
110
|
+
self.data_source = data_source
|
|
111
|
+
self.options = options or {}
|
|
112
|
+
|
|
113
|
+
def to_dict(self):
|
|
114
|
+
return {
|
|
115
|
+
'type': 'chart',
|
|
116
|
+
'properties': {
|
|
117
|
+
'chartType': self.chart_type,
|
|
118
|
+
'dataSource': self.data_source,
|
|
119
|
+
'options': self.options,
|
|
120
|
+
},
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
class Form(Component):
|
|
124
|
+
def __init__(self, children: List[Component], on_submit: List[str]):
|
|
125
|
+
self.children = children
|
|
126
|
+
self.on_submit = on_submit
|
|
127
|
+
|
|
128
|
+
def to_dict(self):
|
|
129
|
+
return {
|
|
130
|
+
'type': 'form',
|
|
131
|
+
'properties': {
|
|
132
|
+
'onSubmit': self.on_submit,
|
|
133
|
+
},
|
|
134
|
+
'children': [child.to_dict() for child in self.children],
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
class FormItem(Component):
|
|
138
|
+
def __init__(self, label: str, children: List[Component], visible: bool = True):
|
|
139
|
+
self.label = label
|
|
140
|
+
self.children = children
|
|
141
|
+
self.visible = visible
|
|
142
|
+
|
|
143
|
+
def to_dict(self):
|
|
144
|
+
return {
|
|
145
|
+
'type': 'form-item',
|
|
146
|
+
'properties': {
|
|
147
|
+
'label': self.label,
|
|
148
|
+
'visible': self.visible,
|
|
149
|
+
},
|
|
150
|
+
'children': [child.to_dict() for child in self.children],
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
class Input(Component):
|
|
154
|
+
def __init__(self, name: str, type: str = 'text', placeholder: str = '', required: bool = False, value: str = None, checked: bool = False):
|
|
155
|
+
self.name = name
|
|
156
|
+
self.type = type
|
|
157
|
+
self.placeholder = placeholder
|
|
158
|
+
self.required = required
|
|
159
|
+
self.value = value
|
|
160
|
+
self.checked = checked
|
|
161
|
+
|
|
162
|
+
def to_dict(self):
|
|
163
|
+
return {
|
|
164
|
+
'type': 'input',
|
|
165
|
+
'properties': {
|
|
166
|
+
'name': self.name,
|
|
167
|
+
'type': self.type,
|
|
168
|
+
'placeholder': self.placeholder,
|
|
169
|
+
'required': self.required,
|
|
170
|
+
'value': self.value,
|
|
171
|
+
'checked': self.checked,
|
|
172
|
+
},
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
class TextArea(Component):
|
|
176
|
+
def __init__(self, name: str, placeholder: str = '', value: str = None, required: bool = False, rows: int = 3):
|
|
177
|
+
self.name = name
|
|
178
|
+
self.placeholder = placeholder
|
|
179
|
+
self.value = value
|
|
180
|
+
self.required = required
|
|
181
|
+
self.rows = rows
|
|
182
|
+
|
|
183
|
+
def to_dict(self):
|
|
184
|
+
return {
|
|
185
|
+
'type': 'textarea',
|
|
186
|
+
'properties': {
|
|
187
|
+
'name': self.name,
|
|
188
|
+
'placeholder': self.placeholder,
|
|
189
|
+
'value': self.value,
|
|
190
|
+
'required': self.required,
|
|
191
|
+
'rows': self.rows,
|
|
192
|
+
},
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
class Upload(Component):
|
|
196
|
+
def __init__(self, name: str, required: bool, multiple: bool = False):
|
|
197
|
+
self.name = name
|
|
198
|
+
self.required = required
|
|
199
|
+
self.multiple = multiple
|
|
200
|
+
|
|
201
|
+
def to_dict(self):
|
|
202
|
+
return {
|
|
203
|
+
'type': 'upload',
|
|
204
|
+
'properties': {
|
|
205
|
+
'name': self.name,
|
|
206
|
+
'required': self.required,
|
|
207
|
+
'multiple': self.multiple,
|
|
208
|
+
},
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
class Button:
|
|
212
|
+
def __init__(
|
|
213
|
+
self,
|
|
214
|
+
label: str = '',
|
|
215
|
+
on_click: str = None,
|
|
216
|
+
button_type: str = 'button',
|
|
217
|
+
condition: str = None,
|
|
218
|
+
confirm: bool = False,
|
|
219
|
+
confirmMessage: str = '',
|
|
220
|
+
style: dict = None,
|
|
221
|
+
icon: str = None,
|
|
222
|
+
disabled: bool = False,
|
|
223
|
+
btn_class: str = 'btn btn-secondary',
|
|
224
|
+
):
|
|
225
|
+
self.label = label
|
|
226
|
+
self.on_click = on_click
|
|
227
|
+
self.button_type = button_type
|
|
228
|
+
self.condition = condition
|
|
229
|
+
self.confirm = confirm
|
|
230
|
+
self.confirmMessage = confirmMessage
|
|
231
|
+
self.style = style or {}
|
|
232
|
+
self.icon = icon
|
|
233
|
+
self.disabled = disabled
|
|
234
|
+
self.btn_class = btn_class
|
|
235
|
+
|
|
236
|
+
def to_dict(self):
|
|
237
|
+
return {
|
|
238
|
+
'type': 'button',
|
|
239
|
+
'properties': {
|
|
240
|
+
'label': self.label,
|
|
241
|
+
'onClick': self.on_click,
|
|
242
|
+
'buttonType': self.button_type,
|
|
243
|
+
'condition': self.condition,
|
|
244
|
+
'confirm': self.confirm,
|
|
245
|
+
'confirmMessage': self.confirmMessage,
|
|
246
|
+
'style': self.style,
|
|
247
|
+
'icon': self.icon,
|
|
248
|
+
'disabled': self.disabled,
|
|
249
|
+
'btnClass': self.btn_class,
|
|
250
|
+
},
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
class Text(Component):
|
|
254
|
+
def __init__(self, content: Union[str, List[Dict[str, Any]]], style: Optional[Dict[str, Any]] = None):
|
|
255
|
+
self.content = content
|
|
256
|
+
self.style = style
|
|
257
|
+
|
|
258
|
+
def to_dict(self):
|
|
259
|
+
return {
|
|
260
|
+
'type': 'text',
|
|
261
|
+
'properties': {
|
|
262
|
+
'content': self.content,
|
|
263
|
+
'style': self.style,
|
|
264
|
+
},
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
class Select(Component):
|
|
268
|
+
def __init__(
|
|
269
|
+
self,
|
|
270
|
+
name: str,
|
|
271
|
+
options: List[Dict[str, Any]],
|
|
272
|
+
multiple: bool = False,
|
|
273
|
+
required: bool = False,
|
|
274
|
+
placeholder: Optional[str] = None,
|
|
275
|
+
label_field: Optional[str] = 'label',
|
|
276
|
+
value_field: Optional[str] = 'value',
|
|
277
|
+
on_change: Optional[str] = None,
|
|
278
|
+
value: Optional[str] = None,
|
|
279
|
+
):
|
|
280
|
+
self.name = name
|
|
281
|
+
self.options = options
|
|
282
|
+
self.multiple = multiple
|
|
283
|
+
self.required = required
|
|
284
|
+
self.placeholder = placeholder
|
|
285
|
+
self.value_field = value_field
|
|
286
|
+
self.label_field = label_field
|
|
287
|
+
self.on_change = on_change
|
|
288
|
+
self.value = value
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
def to_dict(self):
|
|
292
|
+
return {
|
|
293
|
+
'type': 'select',
|
|
294
|
+
'properties': {
|
|
295
|
+
'name': self.name,
|
|
296
|
+
'options': self.options,
|
|
297
|
+
'multiple': self.multiple,
|
|
298
|
+
'required': self.required,
|
|
299
|
+
'placeholder': self.placeholder,
|
|
300
|
+
'labelField': self.label_field,
|
|
301
|
+
'valueField': self.value_field,
|
|
302
|
+
'onChange': self.on_change,
|
|
303
|
+
'value': self.value,
|
|
304
|
+
},
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
class Checkbox(Component):
|
|
308
|
+
def __init__(self, name: str, label: Optional[str] = None, checked: bool = False):
|
|
309
|
+
self.name = name
|
|
310
|
+
self.label = label
|
|
311
|
+
self.checked = checked
|
|
312
|
+
|
|
313
|
+
def to_dict(self):
|
|
314
|
+
return {
|
|
315
|
+
'type': 'checkbox',
|
|
316
|
+
'properties': {
|
|
317
|
+
'name': self.name,
|
|
318
|
+
'label': self.label,
|
|
319
|
+
'checked': self.checked,
|
|
320
|
+
},
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
class Tabs(Component):
|
|
324
|
+
def __init__(self, children: List['Tab']):
|
|
325
|
+
self.children = children
|
|
326
|
+
|
|
327
|
+
def to_dict(self):
|
|
328
|
+
return {
|
|
329
|
+
'type': 'tabs',
|
|
330
|
+
'children': [child.to_dict() for child in self.children],
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
class Tab(Component):
|
|
334
|
+
def __init__(self, label: str, children: List[Component]):
|
|
335
|
+
self.label = label
|
|
336
|
+
self.children = children
|
|
337
|
+
|
|
338
|
+
def to_dict(self):
|
|
339
|
+
return {
|
|
340
|
+
'type': 'tab',
|
|
341
|
+
'properties': {
|
|
342
|
+
'label': self.label,
|
|
343
|
+
},
|
|
344
|
+
'children': [child.to_dict() for child in self.children],
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
class ModalDialog(Component):
|
|
348
|
+
def __init__(
|
|
349
|
+
self,
|
|
350
|
+
name: str,
|
|
351
|
+
title: str,
|
|
352
|
+
content: List[Component],
|
|
353
|
+
visible: bool = False,
|
|
354
|
+
on_close: Optional[str] = None,
|
|
355
|
+
):
|
|
356
|
+
self.name = name
|
|
357
|
+
self.title = title
|
|
358
|
+
self.content = content
|
|
359
|
+
self.visible = visible
|
|
360
|
+
self.on_close = on_close
|
|
361
|
+
|
|
362
|
+
def to_dict(self):
|
|
363
|
+
return {
|
|
364
|
+
'type': 'modal-dialog',
|
|
365
|
+
'properties': {
|
|
366
|
+
'name': self.name,
|
|
367
|
+
'title': self.title,
|
|
368
|
+
'visible': self.visible,
|
|
369
|
+
'onClose': self.on_close,
|
|
370
|
+
},
|
|
371
|
+
'children': [component.to_dict() for component in self.content],
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
class Page(Component):
|
|
375
|
+
def __init__(self, name: str, label: str, main: bool, path: str, components: List[Component], on_load: Optional[str] = None):
|
|
376
|
+
self.name = name
|
|
377
|
+
self.label = label
|
|
378
|
+
self.main = main
|
|
379
|
+
self.path = path
|
|
380
|
+
self.components = components
|
|
381
|
+
self.on_load = on_load
|
|
382
|
+
|
|
383
|
+
def to_dict(self):
|
|
384
|
+
return {
|
|
385
|
+
'type': 'page',
|
|
386
|
+
'properties': {
|
|
387
|
+
'name': self.name,
|
|
388
|
+
'path': self.path,
|
|
389
|
+
'label': self.label,
|
|
390
|
+
'main': self.main,
|
|
391
|
+
'onLoad': self.on_load,
|
|
392
|
+
},
|
|
393
|
+
'children': [component.to_dict() for component in self.components],
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
class Action:
|
|
397
|
+
def __init__(
|
|
398
|
+
self,
|
|
399
|
+
action_type: str,
|
|
400
|
+
method: str,
|
|
401
|
+
url: Optional[str] = None,
|
|
402
|
+
data: Optional[Any] = None,
|
|
403
|
+
content_type: Optional[str] = None,
|
|
404
|
+
params: Optional[Dict[str, Any]] = None,
|
|
405
|
+
state: Optional[str] = None,
|
|
406
|
+
before_action: Optional[str] = None,
|
|
407
|
+
on_success: Optional[Any] = None,
|
|
408
|
+
on_error: Optional[Any] = None,
|
|
409
|
+
actions: Optional[List[Union['Action', str]]] = None,
|
|
410
|
+
):
|
|
411
|
+
self.action_type = action_type
|
|
412
|
+
self.method = method
|
|
413
|
+
self.url = url
|
|
414
|
+
self.data = data
|
|
415
|
+
self.content_type = content_type
|
|
416
|
+
self.params = params
|
|
417
|
+
self.state = state
|
|
418
|
+
self.before_action = before_action
|
|
419
|
+
self.on_success = on_success
|
|
420
|
+
self.on_error = on_error
|
|
421
|
+
self.actions = actions or []
|
|
422
|
+
|
|
423
|
+
def to_dict(self):
|
|
424
|
+
return {
|
|
425
|
+
'type': self.action_type,
|
|
426
|
+
'method': self.method,
|
|
427
|
+
'url': self.url,
|
|
428
|
+
'data': self.data,
|
|
429
|
+
'contentType': self.content_type,
|
|
430
|
+
'params': self.params,
|
|
431
|
+
'state': self.state,
|
|
432
|
+
'beforeAction': self.before_action,
|
|
433
|
+
'onSuccess': self.on_success,
|
|
434
|
+
'onError': self.on_error,
|
|
435
|
+
'actions': [action.to_dict() if isinstance(action, Action) else action for action in self.actions],
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
class CustomInputOutputContent(Component):
|
|
440
|
+
def __init__(
|
|
441
|
+
self,
|
|
442
|
+
data_source: str,
|
|
443
|
+
actions: Optional[List[Dict[str, Any]]] = None,
|
|
444
|
+
):
|
|
445
|
+
self.data_source = data_source
|
|
446
|
+
self.actions = actions or []
|
|
447
|
+
|
|
448
|
+
def to_dict(self):
|
|
449
|
+
return {
|
|
450
|
+
'type': 'custom-input-output-content',
|
|
451
|
+
'properties': {
|
|
452
|
+
'dataSource': self.data_source,
|
|
453
|
+
'actions': self.actions,
|
|
454
|
+
},
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
def render(
|
|
458
|
+
layout: str,
|
|
459
|
+
components: List[Component],
|
|
460
|
+
actions: Optional[Dict[str, Action]] = None,
|
|
461
|
+
initial_actions: Optional[List[str]] = None,
|
|
462
|
+
pages: Optional[List['Page']] = None,
|
|
463
|
+
) -> Dict[str, Any]:
|
|
464
|
+
render_def = {
|
|
465
|
+
'layout': layout,
|
|
466
|
+
'components': [component.to_dict() for component in components],
|
|
467
|
+
'actions': {name: action.to_dict() for name, action in (actions or {}).items()},
|
|
468
|
+
'initialActions': initial_actions or [],
|
|
469
|
+
}
|
|
470
|
+
if pages:
|
|
471
|
+
render_def['pages'] = [page.to_dict() for page in pages]
|
|
472
|
+
return render_def
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
|