zcatalyst-cli 1.18.0-beta.9 → 1.18.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.
- package/README.md +11 -6
- package/docs/commands/slate/unlink.toml +9 -0
- package/docs/endpoints/lib/env.toml +3 -1
- package/docs/endpoints/lib/slate.toml +3 -0
- package/docs/serve/server/lib/slate/index.toml +14 -0
- package/docs/slate-utils.toml +4 -0
- package/docs/util_modules/config/lib/slate.toml +4 -0
- package/lib/archiver.js +18 -9
- package/lib/authentication/login.js +6 -5
- package/lib/code-deck.js +5 -6
- package/lib/command_needs/auth.js +1 -1
- package/lib/command_needs/rc.js +40 -3
- package/lib/commands/codelib/install.js +1 -0
- package/lib/commands/deploy/index.js +4 -0
- package/lib/commands/deploy/slate.js +58 -0
- package/lib/commands/index.js +2 -3
- package/lib/commands/init.js +0 -10
- package/lib/commands/slate/create.js +59 -0
- package/lib/commands/slate/link.js +59 -0
- package/lib/commands/slate/unlink.js +75 -0
- package/lib/commands/zest/generate/index.js +1 -6
- package/lib/config-store.js +2 -1
- package/lib/deploy/features/index.js +3 -0
- package/lib/deploy/features/slate.js +123 -0
- package/lib/endpoints/index.js +8 -1
- package/lib/endpoints/lib/env.js +2 -1
- package/lib/endpoints/lib/sdk.js +2 -2
- package/lib/endpoints/lib/slate.js +107 -0
- package/lib/fn-utils/lib/common.js +1 -1
- package/lib/iac/status/deploy.js +1 -5
- package/lib/index.js +1 -1
- package/lib/init/features/appsail/index.js +2 -3
- package/lib/init/features/index.js +13 -1
- package/lib/init/features/project.js +1 -1
- package/lib/init/features/slate/index.js +313 -0
- package/lib/internal/api.js +1 -1
- package/lib/internal/command.js +10 -6
- package/lib/port-resolver.js +7 -0
- package/lib/prompt/index.js +22 -6
- package/lib/prompt/types/file-path.js +10 -7
- package/lib/serve/features/index.js +8 -1
- package/lib/serve/features/slate.js +47 -0
- package/lib/serve/server/index.js +61 -1
- package/lib/serve/server/lib/appsail/index.js +1 -1
- package/lib/serve/server/lib/master/index.js +25 -21
- package/lib/serve/server/lib/master/slate.js +45 -0
- package/lib/serve/server/lib/master/utils.js +9 -3
- package/lib/serve/server/lib/slate/index.js +115 -0
- package/lib/serve/server/lib/slate/static-server.js +194 -0
- package/lib/serve/server/lib/web_client/server.js +2 -1
- package/lib/slate-utils.js +212 -0
- package/lib/util_modules/config/index.js +3 -1
- package/lib/util_modules/config/lib/slate.js +98 -0
- package/lib/util_modules/constants/lib/cliq-handlers.js +18 -10
- package/lib/util_modules/constants/lib/dc-type.js +8 -0
- package/lib/util_modules/constants/lib/default.js +4 -0
- package/lib/util_modules/constants/lib/file-names.js +7 -1
- package/lib/util_modules/constants/lib/folder-names.js +1 -0
- package/lib/util_modules/constants/lib/placeholders.js +2 -1
- package/lib/util_modules/constants/lib/scopes.js +1 -6
- package/lib/util_modules/context-help.js +2 -2
- package/lib/util_modules/fs/lib/async.js +14 -3
- package/lib/util_modules/fs/lib/sync.js +6 -1
- package/lib/util_modules/parser/toml.js +20 -5
- package/package.json +3 -3
- package/templates/event/integ/cliq/bot/action_handler.json +13 -4
- package/templates/event/integ/cliq/bot/call_handler.json +41 -0
- package/templates/event/integ/cliq/bot/context_handler.json +11 -3
- package/templates/event/integ/cliq/bot/incomingwebhook_handler.json +11 -3
- package/templates/event/integ/cliq/bot/mention_handler.json +12 -4
- package/templates/event/integ/cliq/bot/message_handler.json +13 -4
- package/templates/event/integ/cliq/bot/participation_handler.json +13 -3
- package/templates/event/integ/cliq/bot/welcome_handler.json +12 -8
- package/templates/event/integ/cliq/command/execution_handler.json +12 -3
- package/templates/event/integ/cliq/command/suggestion_handler.json +18 -4
- package/templates/event/integ/cliq/{installation → extension}/installation_handler.json +13 -4
- package/templates/event/integ/cliq/{installation → extension}/installation_validator.json +13 -5
- package/templates/event/integ/cliq/extension/uninstallation_handler.json +37 -0
- package/templates/event/integ/cliq/function/button_handler.json +13 -5
- package/templates/event/integ/cliq/function/form_change_handler.json +9 -3
- package/templates/event/integ/cliq/function/form_handler.json +11 -3
- package/templates/event/integ/cliq/function/form_values_handler.json +9 -3
- package/templates/event/integ/cliq/function/form_view_handler.json +26 -0
- package/templates/event/integ/cliq/function/widget_button_handler.json +14 -5
- package/templates/event/integ/cliq/link_preview/action_handler.json +54 -0
- package/templates/event/integ/cliq/link_preview/after_send_handler.json +47 -0
- package/templates/event/integ/cliq/link_preview/menu_handler.json +47 -0
- package/templates/event/integ/cliq/link_preview/preview_handler.json +47 -0
- package/templates/event/integ/cliq/messageaction/execution_handler.json +11 -3
- package/templates/event/integ/cliq/widget/view_handler.json +12 -4
- package/templates/init/client/react/react_js/template/src/index.js +3 -3
- package/templates/init/client/react/react_ts/template/src/index.tsx +3 -3
- package/templates/init/client/react/react_ts/template.json +3 -3
- package/templates/init/functions/java/event/sample.java +4 -0
- package/templates/init/functions/java/integ/cliq/com/handlers/BotHandler.java +29 -23
- package/templates/init/functions/java/integ/cliq/com/handlers/CommandHandler.java +14 -17
- package/templates/init/functions/java/integ/cliq/com/handlers/ExtensionHandler.java +41 -0
- package/templates/init/functions/java/integ/cliq/com/handlers/FunctionHandler.java +74 -22
- package/templates/init/functions/java/integ/cliq/com/handlers/LinkPreviewHandler.java +108 -0
- package/templates/init/functions/java/integ/cliq/com/handlers/MessageActionHandler.java +6 -8
- package/templates/init/functions/java/integ/cliq/sample.java +10 -0
- package/templates/init/functions/node/aio/package.json +1 -1
- package/templates/init/functions/node/bio/package.json +1 -1
- package/templates/init/functions/node/cron/package.json +1 -1
- package/templates/init/functions/node/event/package.json +1 -1
- package/templates/init/functions/node/event/sample.js +1 -0
- package/templates/init/functions/node/event/types/event.d.ts +7 -0
- package/templates/init/functions/node/integ/cliq/handlers/bot-handler.js +4 -0
- package/templates/init/functions/node/integ/cliq/handlers/command-handler.js +3 -5
- package/templates/init/functions/node/integ/cliq/handlers/{installation-validator.js → extension-handler.js} +20 -3
- package/templates/init/functions/node/integ/cliq/handlers/function-handler.js +42 -0
- package/templates/init/functions/node/integ/cliq/handlers/link-preview-handler.js +73 -0
- package/templates/init/functions/node/integ/cliq/package.json +1 -1
- package/templates/init/functions/node/integ/convokraft/package.json +1 -1
- package/templates/init/functions/node/job/package.json +1 -1
- package/templates/init/functions/python/event/sample.py +9 -5
- package/templates/init/functions/python/integ/cliq/handlers/bot_handler.py +13 -3
- package/templates/init/functions/python/integ/cliq/handlers/command_handler.py +7 -7
- package/templates/init/functions/python/integ/cliq/handlers/extension_handler.py +25 -0
- package/templates/init/functions/python/integ/cliq/handlers/function_handler.py +54 -10
- package/templates/init/functions/python/integ/cliq/handlers/link_preview_handler.py +76 -0
- package/templates/init/functions/python/integ/cliq/handlers/widget_handler.py +10 -9
- package/templates/init/functions/python/integ/cliq/sample.py +2 -2
- package/templates/init.txt +2 -1
- package/templates/init/functions/java/integ/cliq/com/handlers/InstallationHandler.java +0 -20
- package/templates/init/functions/java/integ/cliq/com/handlers/InstallationValidator.java +0 -22
- package/templates/init/functions/node/integ/cliq/handlers/installation-handler.js +0 -15
- package/templates/init/functions/python/integ/cliq/handlers/installation_handler.py +0 -12
- package/templates/init/functions/python/integ/cliq/handlers/installation_validator.py +0 -16
|
@@ -7,12 +7,16 @@ def handler(event, context):
|
|
|
7
7
|
|
|
8
8
|
'''Event Functionalities'''
|
|
9
9
|
data = event.get_data() # event data
|
|
10
|
+
raw_data = event.get_raw_data() # raw event data
|
|
10
11
|
time = event.get_time() # event occurred time
|
|
11
|
-
action = event.get_action()
|
|
12
|
-
source_details = event.get_source()
|
|
13
|
-
source_entity_id = event.get_source_entity_id()
|
|
14
|
-
event_bus_details = event.get_event_bus_details()
|
|
15
|
-
project_details = event.get_project_details()
|
|
12
|
+
action = event.get_action() # get event action
|
|
13
|
+
source_details = event.get_source() # get event source
|
|
14
|
+
source_entity_id = event.get_source_entity_id() # get the source entity id
|
|
15
|
+
event_bus_details = event.get_event_bus_details() # get event bus details
|
|
16
|
+
project_details = event.get_project_details() # get project details
|
|
17
|
+
|
|
18
|
+
logging.info('event data: ' + str(data))
|
|
19
|
+
logging.info('raw data: ' + str(raw_data))
|
|
16
20
|
|
|
17
21
|
'''Context Functionalities'''
|
|
18
22
|
# remaining_execution_time_ms = context.get_remaining_execution_time_ms()
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import json
|
|
2
|
+
import logging
|
|
3
|
+
|
|
2
4
|
from zcatalyst_cliq.bot_handler import (
|
|
3
5
|
welcome_handler,
|
|
4
6
|
message_handler,
|
|
@@ -7,6 +9,7 @@ from zcatalyst_cliq.bot_handler import (
|
|
|
7
9
|
menu_action_handler,
|
|
8
10
|
webhook_handler,
|
|
9
11
|
participation_handler,
|
|
12
|
+
call_handler,
|
|
10
13
|
BotWelcomeHandlerRequest,
|
|
11
14
|
BotMessageHandlerRequest,
|
|
12
15
|
BotContextHandlerRequest,
|
|
@@ -14,10 +17,12 @@ from zcatalyst_cliq.bot_handler import (
|
|
|
14
17
|
BotMenuActionHandlerRequest,
|
|
15
18
|
BotParticipationHandlerRequest,
|
|
16
19
|
BotWebHookHandlerRequest,
|
|
17
|
-
HandlerResponse
|
|
20
|
+
HandlerResponse,
|
|
21
|
+
BotCallHandlerRequest
|
|
18
22
|
)
|
|
19
|
-
from
|
|
20
|
-
import
|
|
23
|
+
from zcatalyst_cliq.response_types import VoidResponse
|
|
24
|
+
from zcatalyst_sdk import CatalystApp
|
|
25
|
+
|
|
21
26
|
|
|
22
27
|
@welcome_handler
|
|
23
28
|
def welcome_handler_fn(req: BotWelcomeHandlerRequest, res: HandlerResponse, *args):
|
|
@@ -172,3 +177,8 @@ def webhook_fn(req: BotWebHookHandlerRequest, res: HandlerResponse, *args):
|
|
|
172
177
|
res.add_slides(gif_slide)
|
|
173
178
|
|
|
174
179
|
return res
|
|
180
|
+
|
|
181
|
+
@call_handler
|
|
182
|
+
def call(req: BotCallHandlerRequest, res:VoidResponse):
|
|
183
|
+
# Logic for bot call post handling
|
|
184
|
+
return res
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from typing import List
|
|
2
|
+
|
|
2
3
|
import zcatalyst_cliq.command_handler as command
|
|
3
4
|
from zcatalyst_cliq.command_handler import (
|
|
4
5
|
execution_handler,
|
|
@@ -12,7 +13,7 @@ from zcatalyst_cliq.command_handler import (
|
|
|
12
13
|
def executor(req: CommandHandlerRequest, res: HandlerResponse, *args):
|
|
13
14
|
text = ''
|
|
14
15
|
cmd = req.name
|
|
15
|
-
if cmd == '
|
|
16
|
+
if cmd == 'catalystresource':
|
|
16
17
|
suggestions = req.selections
|
|
17
18
|
if not suggestions:
|
|
18
19
|
text = 'Please select a suggestion from the command'
|
|
@@ -24,7 +25,7 @@ def executor(req: CommandHandlerRequest, res: HandlerResponse, *args):
|
|
|
24
25
|
text = prefix + '[CLI Documentation](https://www.zoho.com/catalyst/help/cli-command-reference.html)'
|
|
25
26
|
else:
|
|
26
27
|
text = prefix + '[help documentation](https://www.zoho.com/catalyst/help/)'
|
|
27
|
-
elif cmd == '
|
|
28
|
+
elif cmd == 'getform':
|
|
28
29
|
return get_form()
|
|
29
30
|
else:
|
|
30
31
|
text = 'Command executed successfully!'
|
|
@@ -34,7 +35,7 @@ def executor(req: CommandHandlerRequest, res: HandlerResponse, *args):
|
|
|
34
35
|
|
|
35
36
|
@suggestion_handler
|
|
36
37
|
def suggester(req: CommandHandlerRequest, res: List[CommandSuggestion], *args):
|
|
37
|
-
if req.name == '
|
|
38
|
+
if req.name == 'catalystresource':
|
|
38
39
|
suggestion1 = command.new_command_suggestion()
|
|
39
40
|
suggestion1.title = 'API doc'
|
|
40
41
|
suggestion1.description = 'Catalyst API documentation'
|
|
@@ -52,6 +53,7 @@ def suggester(req: CommandHandlerRequest, res: List[CommandSuggestion], *args):
|
|
|
52
53
|
|
|
53
54
|
res.extend([suggestion1,suggestion2,suggestion3])
|
|
54
55
|
return res
|
|
56
|
+
return [command.new_command_suggestion()]
|
|
55
57
|
|
|
56
58
|
|
|
57
59
|
def get_form():
|
|
@@ -62,10 +64,8 @@ def get_form():
|
|
|
62
64
|
form.button_label = 'Raise Request'
|
|
63
65
|
form.version = 1
|
|
64
66
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
form.actions = actions
|
|
67
|
+
action = form.new_form_action('formFunctionLatest') # ENTER YOUR FORM FUNCTION NAME HERE
|
|
68
|
+
form.action = action
|
|
69
69
|
|
|
70
70
|
user_name = form.new_form_input()
|
|
71
71
|
user_name.type = 'text'
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from zcatalyst_cliq.extension_handler import validate_installation, ExtensionHandlerRequest, handle_installation, \
|
|
2
|
+
handle_uninstallation
|
|
3
|
+
from zcatalyst_cliq.response_types import InstallationResponse, VoidResponse
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@validate_installation
|
|
7
|
+
def validate_installation(req: ExtensionHandlerRequest,res: InstallationResponse, *args):
|
|
8
|
+
if req.user.first_name == '**INVALID_USER**' and req.app_info.type == 'upgrade':
|
|
9
|
+
res.status = 400
|
|
10
|
+
res.title = 'Update not allowed !'
|
|
11
|
+
res.message = 'Sorry. Update not allowed for the current app. Please contact admin.'
|
|
12
|
+
else:
|
|
13
|
+
res.status = 200
|
|
14
|
+
return res
|
|
15
|
+
|
|
16
|
+
@handle_installation
|
|
17
|
+
def installation_handler(req: ExtensionHandlerRequest, res: InstallationResponse, *args):
|
|
18
|
+
'''Logic for installation post handling'''
|
|
19
|
+
res.status = 200
|
|
20
|
+
return res
|
|
21
|
+
|
|
22
|
+
@handle_uninstallation
|
|
23
|
+
def handle_uninstallation(req: ExtensionHandlerRequest, res: VoidResponse, *args):
|
|
24
|
+
# Logic for uninstallation post handling
|
|
25
|
+
return res
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from datetime import datetime
|
|
2
|
+
|
|
2
3
|
from zcatalyst_cliq import function_handler
|
|
3
4
|
from zcatalyst_cliq.function_handler import (
|
|
4
5
|
button_function_handler,
|
|
@@ -12,8 +13,10 @@ from zcatalyst_cliq.function_handler import (
|
|
|
12
13
|
HandlerResponse,
|
|
13
14
|
FormChangeResponse,
|
|
14
15
|
FormDynamicFieldResponse,
|
|
15
|
-
WidgetResponse
|
|
16
|
+
WidgetResponse,
|
|
17
|
+
form_view_handler
|
|
16
18
|
)
|
|
19
|
+
from zcatalyst_cliq.response_types import Form
|
|
17
20
|
|
|
18
21
|
|
|
19
22
|
@button_function_handler
|
|
@@ -221,6 +224,47 @@ def handle_dynamic_field(req: FormFunctionRequest, res: FormDynamicFieldResponse
|
|
|
221
224
|
res.add_options(res.new_form_value(mobile,mobile.lower().replace(' ','_')))
|
|
222
225
|
return res
|
|
223
226
|
|
|
227
|
+
@form_view_handler
|
|
228
|
+
def form_view_handler(req: FormFunctionRequest, res: Form):
|
|
229
|
+
res.title = 'Asset Request'
|
|
230
|
+
res.hint = 'Raise your asset request'
|
|
231
|
+
res.name = 'ID'
|
|
232
|
+
res.button_label = 'Raise Request'
|
|
233
|
+
res.version = 1
|
|
234
|
+
|
|
235
|
+
user_name = res.new_form_input()
|
|
236
|
+
user_name.type = 'text'
|
|
237
|
+
user_name.name = 'username'
|
|
238
|
+
user_name.label = 'Name'
|
|
239
|
+
user_name.hint = 'Please enter your name'
|
|
240
|
+
user_name.placeholder = 'John Reese'
|
|
241
|
+
user_name.mandatory = True
|
|
242
|
+
user_name.value = 'Harold Finch'
|
|
243
|
+
res.add_inputs(user_name)
|
|
244
|
+
|
|
245
|
+
email = res.new_form_input()
|
|
246
|
+
email.type = 'text'
|
|
247
|
+
email.format = 'email'
|
|
248
|
+
email.name = 'email'
|
|
249
|
+
email.label = 'Email'
|
|
250
|
+
email.hint = 'Enter your email address'
|
|
251
|
+
email.placeholder = "johnreese@poi.com"
|
|
252
|
+
email.mandatory = True
|
|
253
|
+
email.value = "haroldfinch@samaritan.com"
|
|
254
|
+
|
|
255
|
+
asset_type = res.new_form_input()
|
|
256
|
+
asset_type.type = 'select'
|
|
257
|
+
asset_type.trigger_on_change = True
|
|
258
|
+
asset_type.name = 'asset_type'
|
|
259
|
+
asset_type.label = "Asset Type"
|
|
260
|
+
asset_type.hint = "Choose your request asset type"
|
|
261
|
+
asset_type.placeholder = "Mobile"
|
|
262
|
+
asset_type.mandatory = True
|
|
263
|
+
asset_type.add_options(asset_type.new_form_value('Laptop', 'laptop'))
|
|
264
|
+
asset_type.add_options(asset_type.new_form_value('Mobile', 'mobile'))
|
|
265
|
+
|
|
266
|
+
res.add_inputs(email, asset_type)
|
|
267
|
+
return res
|
|
224
268
|
|
|
225
269
|
@widget_button_handler
|
|
226
270
|
def widget_button(req: WidgetFunctionRequest, res: WidgetResponse, *args):
|
|
@@ -274,7 +318,7 @@ def widget_button(req: WidgetFunctionRequest, res: WidgetResponse, *args):
|
|
|
274
318
|
input2.value = id
|
|
275
319
|
|
|
276
320
|
form.add_inputs(input1, input2)
|
|
277
|
-
form.action = form.new_form_action('
|
|
321
|
+
form.action = form.new_form_action('appletForm') # ** ENTER YOUR FORM FUNCTION NAME HERE **
|
|
278
322
|
return form
|
|
279
323
|
|
|
280
324
|
elif id == 'breadcrumbs':
|
|
@@ -293,7 +337,7 @@ def widget_button(req: WidgetFunctionRequest, res: WidgetResponse, *args):
|
|
|
293
337
|
first_nav = {
|
|
294
338
|
'label': 'Page : ' + page,
|
|
295
339
|
'type': 'invoke.function',
|
|
296
|
-
'name': '
|
|
340
|
+
'name': 'appletFunction',
|
|
297
341
|
'id': 'breadcrumbs'
|
|
298
342
|
}
|
|
299
343
|
|
|
@@ -306,7 +350,7 @@ def widget_button(req: WidgetFunctionRequest, res: WidgetResponse, *args):
|
|
|
306
350
|
banner_button = {
|
|
307
351
|
'label': 'Banner',
|
|
308
352
|
'type': 'invoke.function',
|
|
309
|
-
'name': '
|
|
353
|
+
'name': 'appletFunction',
|
|
310
354
|
'id': 'banner'
|
|
311
355
|
}
|
|
312
356
|
|
|
@@ -352,7 +396,7 @@ def get_button_section():
|
|
|
352
396
|
button2 = button_element1.new_widget_button()
|
|
353
397
|
button2.label = 'Banner'
|
|
354
398
|
button2.type = 'invoke.function'
|
|
355
|
-
button2.name = '
|
|
399
|
+
button2.name = 'appletFunction'
|
|
356
400
|
button2.id = 'banner'
|
|
357
401
|
|
|
358
402
|
button3 = button_element1.new_widget_button()
|
|
@@ -374,31 +418,31 @@ def get_button_section():
|
|
|
374
418
|
button5 = button_element2.new_widget_button()
|
|
375
419
|
button5.label = 'Edit Section'
|
|
376
420
|
button5.type = 'invoke.function'
|
|
377
|
-
button5.name = '
|
|
421
|
+
button5.name = 'appletFunction'
|
|
378
422
|
button5.id = 'section'
|
|
379
423
|
|
|
380
424
|
button6 = button_element2.new_widget_button()
|
|
381
425
|
button6.label = 'Form Edit Section'
|
|
382
426
|
button6.type = 'invoke.function'
|
|
383
|
-
button6.name = '
|
|
427
|
+
button6.name = 'appletFunction'
|
|
384
428
|
button6.id = 'formsection'
|
|
385
429
|
|
|
386
430
|
button7 = button_element2.new_widget_button()
|
|
387
431
|
button7.label = 'Banner'
|
|
388
432
|
button7.type = 'invoke.function'
|
|
389
|
-
button7.name = '
|
|
433
|
+
button7.name = 'appletFunction'
|
|
390
434
|
button7.id = 'banner'
|
|
391
435
|
|
|
392
436
|
button8 = button_element2.new_widget_button()
|
|
393
437
|
button8.label = 'Edit Whole Tab'
|
|
394
438
|
button8.type = 'invoke.function'
|
|
395
|
-
button8.name = '
|
|
439
|
+
button8.name = 'appletFunction'
|
|
396
440
|
button8.id = 'tab'
|
|
397
441
|
|
|
398
442
|
button9 = button_element2.new_widget_button()
|
|
399
443
|
button9.label = 'Form Edit Tab'
|
|
400
444
|
button9.type = 'invoke.function'
|
|
401
|
-
button9.name = '
|
|
445
|
+
button9.name = 'appletFunction'
|
|
402
446
|
button9.id = 'formTab'
|
|
403
447
|
|
|
404
448
|
button_element2.add_widget_buttons(button5, button6, button7, button8, button9)
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
from typing import List
|
|
2
|
+
|
|
3
|
+
from zcatalyst_cliq.handler_response import HandlerResponse
|
|
4
|
+
from zcatalyst_cliq.link_preview_handler import (preview_handler, LinkPreviewHandlerRequest, action_handler,
|
|
5
|
+
menu_handler, after_send_handler, new_oembed_actions)
|
|
6
|
+
from zcatalyst_cliq.response_types import UnfurlResponse, OembedActions, OembedFieldData
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@preview_handler
|
|
10
|
+
def preview_handler(req: LinkPreviewHandlerRequest,res: UnfurlResponse):
|
|
11
|
+
res.type = 'link'
|
|
12
|
+
res.title = 'Release checklist | Zoho Cliq'
|
|
13
|
+
res.provider_url = 'https://www.zoho.com/cliq/'
|
|
14
|
+
res.description = 'Release checklist for Cliq 5.0 (Focused on Enterprise and Intelligence)'
|
|
15
|
+
res.dynamic_actions = True
|
|
16
|
+
|
|
17
|
+
fields = res.new_oembed_fields()
|
|
18
|
+
fieldsData: List[OembedFieldData] = list()
|
|
19
|
+
fieldsData.append(fields.new_oembed_field_data('Created By', 'Scott fisher'))
|
|
20
|
+
fieldsData.append(fields.new_oembed_field_data('Created On', '10 Aug, 2023'))
|
|
21
|
+
fieldsData.append(fields.new_oembed_field_data('Last Modified On', '11 Aug, 2023'))
|
|
22
|
+
fieldsData.append(fields.new_oembed_field_data('Tags', '#unfurling_via_extensions #images_and_cards #cliq_360 #Cliq_5.0'))
|
|
23
|
+
fields.data = fieldsData
|
|
24
|
+
res.fields = fields
|
|
25
|
+
|
|
26
|
+
actions: List[OembedActions] = list()
|
|
27
|
+
action = res.new_oembed_actions()
|
|
28
|
+
action.type = 'button'
|
|
29
|
+
action.label = 'Add Comment'
|
|
30
|
+
|
|
31
|
+
confirm = action.new_confirm()
|
|
32
|
+
confirm.title = 'Comment'
|
|
33
|
+
confirm.description = 'Add your comment to the notes'
|
|
34
|
+
confirm.input = 'Type here...'
|
|
35
|
+
action.confirm = confirm
|
|
36
|
+
|
|
37
|
+
params = {'action': 'add_comment'}
|
|
38
|
+
action.params = params
|
|
39
|
+
actions.append(action)
|
|
40
|
+
res.actions = actions
|
|
41
|
+
|
|
42
|
+
return res
|
|
43
|
+
|
|
44
|
+
@action_handler
|
|
45
|
+
def action_handler(req: LinkPreviewHandlerRequest,res: HandlerResponse):
|
|
46
|
+
target: dict = vars(req.target)
|
|
47
|
+
params = vars(target.get('params'))
|
|
48
|
+
action = params.get('action')
|
|
49
|
+
text = ""
|
|
50
|
+
if action == "add_comment":
|
|
51
|
+
text = "Your comment has been added successfully"
|
|
52
|
+
elif action == "delete_note":
|
|
53
|
+
text = "Release checklist | Zoho Cliq note has been deleted"
|
|
54
|
+
elif action == "mark_as_favorite":
|
|
55
|
+
text = "Release checklist | Zoho Cliq note has been marked as favorite"
|
|
56
|
+
return res.new_banner(text,'success')
|
|
57
|
+
|
|
58
|
+
@menu_handler
|
|
59
|
+
def menu_handler(req: LinkPreviewHandlerRequest,res: List[OembedActions]):
|
|
60
|
+
action1 = new_oembed_actions()
|
|
61
|
+
action1.type = 'button'
|
|
62
|
+
action1.label = 'Delete'
|
|
63
|
+
action1.params = {'action': 'delete_note'}
|
|
64
|
+
|
|
65
|
+
action2 = new_oembed_actions()
|
|
66
|
+
action2.type = 'button'
|
|
67
|
+
action2.label = 'Mark as Favorite'
|
|
68
|
+
action2.params = {'action': 'mark_as_favorite'}
|
|
69
|
+
res.extend([action1,action2])
|
|
70
|
+
|
|
71
|
+
return res
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
@after_send_handler
|
|
75
|
+
def after_send_handler(req: LinkPreviewHandlerRequest,res: HandlerResponse):
|
|
76
|
+
return res.new_banner("Release checklist | Zoho Cliq 5.0','success")
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import datetime
|
|
2
|
+
|
|
2
3
|
from zcatalyst_cliq.widget_handler import (
|
|
3
4
|
view_handler,
|
|
4
5
|
WidgetExecutionHandlerRequest,
|
|
@@ -52,7 +53,7 @@ def view_handler(req: WidgetExecutionHandlerRequest, res: WidgetResponse, *args)
|
|
|
52
53
|
fn_button = fn_title.new_widget_button()
|
|
53
54
|
fn_button.type = 'invoke.function'
|
|
54
55
|
fn_button.label = 'Click here'
|
|
55
|
-
fn_button.name = '
|
|
56
|
+
fn_button.name = 'appletFunction' # ** ENTER YOUR WIDGET FUNCTION NAME **
|
|
56
57
|
fn_button.id = 'widgetFn'
|
|
57
58
|
fn_title.add_widget_buttons(fn_button)
|
|
58
59
|
|
|
@@ -179,7 +180,7 @@ def view_handler(req: WidgetExecutionHandlerRequest, res: WidgetResponse, *args)
|
|
|
179
180
|
button2 = button_element1.new_widget_button()
|
|
180
181
|
button2.label = 'Applet Button'
|
|
181
182
|
button2.type = 'invoke.function'
|
|
182
|
-
button2.name = '
|
|
183
|
+
button2.name = 'appletFunction'
|
|
183
184
|
button2.id = 'banner'
|
|
184
185
|
|
|
185
186
|
button3 = button_element1.new_widget_button()
|
|
@@ -202,31 +203,31 @@ def view_handler(req: WidgetExecutionHandlerRequest, res: WidgetResponse, *args)
|
|
|
202
203
|
button5 = button_element2.new_widget_button()
|
|
203
204
|
button5.label = 'Edit Section'
|
|
204
205
|
button5.type = 'invoke.function'
|
|
205
|
-
button5.name = '
|
|
206
|
+
button5.name = 'appletFunction'
|
|
206
207
|
button5.id = 'section'
|
|
207
208
|
|
|
208
209
|
button6 = button_element2.new_button_object()
|
|
209
210
|
button6.label = 'Form Edit Section'
|
|
210
211
|
button6.type = 'invoke.function'
|
|
211
|
-
button6.name = '
|
|
212
|
+
button6.name = 'appletFunction'
|
|
212
213
|
button6.id = 'formsection'
|
|
213
214
|
|
|
214
215
|
button7 = button_element2.new_button_object()
|
|
215
216
|
button7.label = 'Banner'
|
|
216
217
|
button7.type = 'invoke.function'
|
|
217
|
-
button7.name = '
|
|
218
|
+
button7.name = 'appletFunction'
|
|
218
219
|
button7.id = 'banner'
|
|
219
220
|
|
|
220
221
|
button8 = button_element2.new_button_object()
|
|
221
222
|
button8.label = 'Edit Whole Tab'
|
|
222
223
|
button8.type = 'invoke.function'
|
|
223
|
-
button8.name = '
|
|
224
|
+
button8.name = 'appletFunction'
|
|
224
225
|
button8.id = 'tab'
|
|
225
226
|
|
|
226
227
|
button9 = button_element2.new_button_object()
|
|
227
228
|
button9.label = 'Form Edit Tab'
|
|
228
229
|
button9.type = 'invoke.function'
|
|
229
|
-
button9.name = '
|
|
230
|
+
button9.name = 'appletFunction'
|
|
230
231
|
button9.id = 'formTab'
|
|
231
232
|
|
|
232
233
|
button_element2.add_widget_buttons(button5, button6, button7, button8, button9)
|
|
@@ -239,7 +240,7 @@ def view_handler(req: WidgetExecutionHandlerRequest, res: WidgetResponse, *args)
|
|
|
239
240
|
first_nav = {
|
|
240
241
|
'label': 'Page : 1',
|
|
241
242
|
'type': 'invoke.function',
|
|
242
|
-
'name': '
|
|
243
|
+
'name': 'appletFunction',
|
|
243
244
|
'id': 'breadcrumbs'
|
|
244
245
|
}
|
|
245
246
|
|
|
@@ -252,7 +253,7 @@ def view_handler(req: WidgetExecutionHandlerRequest, res: WidgetResponse, *args)
|
|
|
252
253
|
banner_button = {
|
|
253
254
|
'label': 'Banner',
|
|
254
255
|
'type': 'invoke.function',
|
|
255
|
-
'name': '
|
|
256
|
+
'name': 'appletFunction',
|
|
256
257
|
'id': 'banner'
|
|
257
258
|
}
|
|
258
259
|
|
|
@@ -5,11 +5,11 @@ config = {
|
|
|
5
5
|
"handlers": {
|
|
6
6
|
"bot_handler": "handlers/bot_handler.py",
|
|
7
7
|
"function_handler": "handlers/function_handler.py",
|
|
8
|
-
"
|
|
8
|
+
"extension_handler": "handlers/extension_handler.py",
|
|
9
9
|
"command_handler": "handlers/command_handler.py",
|
|
10
10
|
"widget_handler": "handlers/widget_handler.py",
|
|
11
11
|
"messageaction_handler": "handlers/message_action_handler.py",
|
|
12
|
-
"
|
|
12
|
+
"link_preview_handler": "handlers/link_preview_handler.py"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
}
|
package/templates/init.txt
CHANGED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
//$Id$
|
|
2
|
-
package com.handlers;
|
|
3
|
-
|
|
4
|
-
import com.zc.cliq.enums.STATUS;
|
|
5
|
-
import com.zc.cliq.objects.InstallationResponse;
|
|
6
|
-
import com.zc.cliq.requests.InstallationRequest;
|
|
7
|
-
|
|
8
|
-
public class InstallationHandler implements com.zc.cliq.interfaces.InstallationHandler {
|
|
9
|
-
@Override
|
|
10
|
-
public InstallationResponse handleInstallation(InstallationRequest req) throws Exception {
|
|
11
|
-
InstallationResponse resp = InstallationResponse.getInstance();
|
|
12
|
-
/*
|
|
13
|
-
* // Logic for installation post handling {
|
|
14
|
-
*
|
|
15
|
-
* }
|
|
16
|
-
*/
|
|
17
|
-
resp.setStatus(STATUS.SUCCESS);
|
|
18
|
-
return resp;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
//$Id$
|
|
2
|
-
package com.handlers;
|
|
3
|
-
|
|
4
|
-
import com.zc.cliq.enums.EXTENSION_TYPE;
|
|
5
|
-
import com.zc.cliq.enums.STATUS;
|
|
6
|
-
import com.zc.cliq.objects.InstallationResponse;
|
|
7
|
-
import com.zc.cliq.requests.InstallationRequest;
|
|
8
|
-
|
|
9
|
-
public class InstallationValidator implements com.zc.cliq.interfaces.InstallationValidator {
|
|
10
|
-
@Override
|
|
11
|
-
public InstallationResponse validateInstallation(InstallationRequest req) throws Exception {
|
|
12
|
-
InstallationResponse resp = InstallationResponse.getInstance();
|
|
13
|
-
if (req.getUser().getFirstName().equals("**INVALID_USER**") && req.getAppInfo().getType().equals(EXTENSION_TYPE.UPGRADE)) {
|
|
14
|
-
resp.setStatus(STATUS.FAILURE);
|
|
15
|
-
resp.setTitle("Update not allowed !");
|
|
16
|
-
resp.setMessage("Sorry. Update not allowed for the current app. Please contact admin.");
|
|
17
|
-
} else {
|
|
18
|
-
resp.setStatus(STATUS.SUCCESS);
|
|
19
|
-
}
|
|
20
|
-
return resp;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
import Cliq from 'zcatalyst-integ-cliq';
|
|
3
|
-
const installationHandler = Cliq.installationHandler();
|
|
4
|
-
|
|
5
|
-
installationHandler.handleInstallation(async (req, res) => {
|
|
6
|
-
/*
|
|
7
|
-
// Logic for installation post handling
|
|
8
|
-
*{
|
|
9
|
-
*
|
|
10
|
-
*}
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
res.status = 200;
|
|
14
|
-
return res;
|
|
15
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
from zcatalyst_cliq.installation_handler import (
|
|
2
|
-
handle_installation,
|
|
3
|
-
InstallationRequest,
|
|
4
|
-
InstallationResponse
|
|
5
|
-
)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
@handle_installation
|
|
9
|
-
def installation_handler(req: InstallationRequest, res: InstallationResponse, *args):
|
|
10
|
-
'''Logic for installation post handling'''
|
|
11
|
-
res.status = 200
|
|
12
|
-
return res
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
from zcatalyst_cliq.installation_validator import (
|
|
2
|
-
validate_installation,
|
|
3
|
-
InstallationRequest,
|
|
4
|
-
InstallationResponse
|
|
5
|
-
)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
@validate_installation
|
|
9
|
-
def validate_installation(req: InstallationRequest, res: InstallationResponse, *args):
|
|
10
|
-
if req.user.first_name == '**INVALID_USER**' and req.app_info.type == 'upgrade':
|
|
11
|
-
res.status = 400
|
|
12
|
-
res.title = 'Update not allowed !'
|
|
13
|
-
res.message = 'Sorry. Update not allowed for the current app. Please contact admin.'
|
|
14
|
-
else:
|
|
15
|
-
res.status = 200
|
|
16
|
-
return res
|