zcatalyst-cli 1.18.0-beta.9 → 1.19.0
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/signals/generate/index.toml +19 -0
- 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/event/generate/index.js +8 -2
- package/lib/commands/index.js +3 -3
- package/lib/commands/init.js +0 -10
- package/lib/commands/signals/generate/index.js +214 -0
- 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/event_generate/cache.js +35 -33
- package/lib/event_generate/custom.js +15 -19
- package/lib/event_generate/datastore.js +60 -56
- package/lib/event_generate/filestore.js +51 -47
- package/lib/event_generate/github.js +19 -18
- package/lib/event_generate/stratus.js +52 -38
- package/lib/event_generate/user.js +33 -29
- package/lib/event_generate/webapp.js +33 -32
- 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 +3 -4
- 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/appsail.js +7 -2
- 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/shell/dependencies/local-function.js +1 -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/index.js +7 -1
- 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 +18 -1
- package/lib/util_modules/constants/lib/scopes.js +1 -6
- package/lib/util_modules/constants/lib/signals-api-names.js +19 -0
- package/lib/util_modules/constants/lib/signals-publishers-type.js +27 -0
- package/lib/util_modules/constants/lib/signals-publishers.js +10 -0
- package/lib/util_modules/constants/lib/template.js +1 -0
- 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/event/signals.json +26 -0
- 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
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
//$Id$
|
|
2
2
|
package com.handlers;
|
|
3
3
|
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
import com.zc.cliq.enums.RESPONSE_TYPE;
|
|
4
|
+
import com.zc.cliq.enums.MESSAGE_TYPE;
|
|
7
5
|
import com.zc.cliq.objects.Message;
|
|
8
6
|
import com.zc.cliq.requests.MessageActionHandlerRequest;
|
|
9
|
-
import com.zc.cliq.
|
|
7
|
+
import com.zc.cliq.responses.CoreResponse;
|
|
10
8
|
|
|
11
9
|
public class MessageActionHandler implements com.zc.cliq.interfaces.MessageActionHandler {
|
|
12
10
|
@Override
|
|
13
|
-
public
|
|
14
|
-
|
|
11
|
+
public CoreResponse executionHandler(MessageActionHandlerRequest req) throws Exception {
|
|
12
|
+
MESSAGE_TYPE msgType = req.getMessage().getType();
|
|
15
13
|
String firstName = req.getUser() != null ? req.getUser().getFirstName() : "user";
|
|
16
14
|
|
|
17
|
-
String text = "Hey " + firstName + ", You have performed an action on a *" + msgType.
|
|
15
|
+
String text = "Hey " + firstName + ", You have performed an action on a *" + msgType.getType() + "*. Manipulate the message variable and perform your own action.";
|
|
18
16
|
|
|
19
17
|
Message resp = Message.getInstance();
|
|
20
18
|
resp.setText(text);
|
|
21
19
|
|
|
22
|
-
return
|
|
20
|
+
return resp;
|
|
23
21
|
}
|
|
24
22
|
|
|
25
23
|
}
|
|
@@ -19,3 +19,13 @@ public class {{_CLASS_}} implements CatalystIntegFunctionHandler {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* Response type supported by these interface:
|
|
25
|
+
* CoreResponse: BannerResponse,Message,PreviewUrlResponse,Form,VoidResponse
|
|
26
|
+
* FormChangeHandlerResponse: FormChangeHandlerResponse, FormError
|
|
27
|
+
* FormSubmitResponse: BannerResponse,Message,PreviewUrlResponse,Form,FormError,WidgetResponse,WidgetSection,VoidResponse
|
|
28
|
+
* WebhookHandlerResponse: Message,WebhookResponse,VoidResponse
|
|
29
|
+
* WidgetButtonResponse: BannerResponse,PreviewUrlResponse,Form,WidgetResponse,WidgetSection,VoidResponse
|
|
30
|
+
* ButtonFunctionResponse: BannerResponse,Message,PreviewUrlResponse,Form,WidgetResponse,WidgetSection,VoidResponse
|
|
31
|
+
*/
|
|
@@ -8,6 +8,7 @@ module.exports = (event, context) => {
|
|
|
8
8
|
EVENT FUNCTIONALITIES
|
|
9
9
|
*/
|
|
10
10
|
// const DATA = event.getData(); //event data
|
|
11
|
+
// const RAW_DATA = event.getRawData(): //raw data
|
|
11
12
|
// const TIME = event.getTime(); //event occurred time
|
|
12
13
|
|
|
13
14
|
// const ACTION = event.getAction(); //(insert | fetch | invoke ...)
|
|
@@ -24,6 +24,13 @@ export interface EventDetails {
|
|
|
24
24
|
* @returns event data
|
|
25
25
|
*/
|
|
26
26
|
getData: () => Record<string, unknown>;
|
|
27
|
+
/**
|
|
28
|
+
* Functional API to get the raw data of the event function execution.
|
|
29
|
+
*
|
|
30
|
+
* Useful when the event is from {@link https://docs.catalyst.zoho.com/en/signals/ Catalyst Signals}
|
|
31
|
+
* @returns raw event data
|
|
32
|
+
*/
|
|
33
|
+
getRawData: () => Record<string, unknown>;
|
|
27
34
|
/**
|
|
28
35
|
* Functional API to get the time of the event
|
|
29
36
|
* @returns event time
|
|
@@ -180,6 +180,10 @@ botHandler.participationHandler(async (req, res) => {
|
|
|
180
180
|
return res;
|
|
181
181
|
});
|
|
182
182
|
|
|
183
|
+
botHandler.callHandler(async (req, res) => {
|
|
184
|
+
// Logic for bot call post handling
|
|
185
|
+
});
|
|
186
|
+
|
|
183
187
|
function comp(var1, var2) {
|
|
184
188
|
return var1.toUpperCase() === var2.toUpperCase();
|
|
185
189
|
}
|
|
@@ -51,8 +51,8 @@ command.suggestionHandler(async (req, res) => {
|
|
|
51
51
|
suggestion3.imageurl = 'https://www.zohowebstatic.com/sites/default/files/styles/product-home-page/public/catalyst-icon.png';
|
|
52
52
|
|
|
53
53
|
res.push(suggestion1,suggestion2,suggestion3);
|
|
54
|
-
return res;
|
|
55
54
|
}
|
|
55
|
+
return res;
|
|
56
56
|
});
|
|
57
57
|
|
|
58
58
|
function getForm() {
|
|
@@ -63,10 +63,8 @@ function getForm() {
|
|
|
63
63
|
form.button_label = 'Raise Request';
|
|
64
64
|
form.version = 1;
|
|
65
65
|
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
form.actions = actions;
|
|
66
|
+
const action = form.newFormAction('formFunctionLatest');// ** ENTER YOUR FORM FUNCTION NAME HERE **
|
|
67
|
+
form.action = action;
|
|
70
68
|
|
|
71
69
|
const userName = form.newFormInput();
|
|
72
70
|
userName.type = 'text';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
'use strict'
|
|
1
|
+
'use strict';
|
|
2
2
|
import Cliq from 'zcatalyst-integ-cliq';
|
|
3
|
-
const
|
|
3
|
+
const extensionHandler = Cliq.extensionHandler();
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
extensionHandler.validateInstallation(async (req, res) => {
|
|
6
6
|
if(comp(req.user.first_name, '**INVALID_USER**') && comp(req.app_info.type, 'upgrade')) {
|
|
7
7
|
res.status = 400;
|
|
8
8
|
res.title = 'Update not allowed !';
|
|
@@ -13,6 +13,23 @@ installationValidator.validateInstallation(async (req, res) => {
|
|
|
13
13
|
return res;
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
+
extensionHandler.handleInstallation(async (req, res) => {
|
|
17
|
+
/*
|
|
18
|
+
// Logic for installation post handling
|
|
19
|
+
*{
|
|
20
|
+
*
|
|
21
|
+
*}
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
res.status = 200;
|
|
25
|
+
return res;
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
extensionHandler.handleUninstallation(async (req, res) => {
|
|
29
|
+
|
|
30
|
+
// Logic for uninstallation post handling
|
|
31
|
+
});
|
|
32
|
+
|
|
16
33
|
function comp(var1, var2) {
|
|
17
34
|
return var1.toUpperCase() === var2.toUpperCase();
|
|
18
35
|
}
|
|
@@ -218,6 +218,48 @@ functionHandler.formDynamicFieldHandler(async (req, res) => {
|
|
|
218
218
|
return res;
|
|
219
219
|
});
|
|
220
220
|
|
|
221
|
+
functionHandler.formViewHandler(async (req, res) => {
|
|
222
|
+
res.title = 'Asset Request';
|
|
223
|
+
res.hint = 'Raise your asset request';
|
|
224
|
+
res.name = 'ID';
|
|
225
|
+
res.button_label = 'Raise Request';
|
|
226
|
+
res.version = 1;
|
|
227
|
+
|
|
228
|
+
const userName = res.newFormInput();
|
|
229
|
+
userName.type = 'text';
|
|
230
|
+
userName.name = 'username';
|
|
231
|
+
userName.label = 'Name';
|
|
232
|
+
userName.hint = 'Please enter your name';
|
|
233
|
+
userName.placeholder = 'John Reese';
|
|
234
|
+
userName.mandatory = true;
|
|
235
|
+
userName.value = 'Harold Finch';
|
|
236
|
+
res.addInputs(userName);
|
|
237
|
+
|
|
238
|
+
const email = res.newFormInput();
|
|
239
|
+
email.type = 'text';
|
|
240
|
+
email.format = 'email';
|
|
241
|
+
email.name = 'email';
|
|
242
|
+
email.label = 'Email';
|
|
243
|
+
email.hint = 'Enter your email address';
|
|
244
|
+
email.placeholder = "johnreese@poi.com";
|
|
245
|
+
email.mandatory = true;
|
|
246
|
+
email.value = "haroldfinch@samaritan.com";
|
|
247
|
+
|
|
248
|
+
const assetType = res.newFormInput();
|
|
249
|
+
assetType.type = 'select';
|
|
250
|
+
assetType.trigger_on_change = true;
|
|
251
|
+
assetType.name = 'asset-type';
|
|
252
|
+
assetType.label = "Asset Type";
|
|
253
|
+
assetType.hint = "Choose your request asset type";
|
|
254
|
+
assetType.placeholder = "Mobile";
|
|
255
|
+
assetType.mandatory = true;
|
|
256
|
+
assetType.addOption(assetType.newFormValue('Laptop', 'laptop'));
|
|
257
|
+
assetType.addOption(assetType.newFormValue('Mobile', 'mobile'));
|
|
258
|
+
|
|
259
|
+
res.addInputs(email, assetType);
|
|
260
|
+
return res;
|
|
261
|
+
});
|
|
262
|
+
|
|
221
263
|
functionHandler.widgetButtonHandler(async (req, res) => {
|
|
222
264
|
const id = req.target.id;
|
|
223
265
|
switch(id) {
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
import Cliq from 'zcatalyst-integ-cliq';
|
|
3
|
+
const linkPreviewHandler = Cliq.linkPreviewHandler();
|
|
4
|
+
|
|
5
|
+
linkPreviewHandler.previewHandler(async (req, res) => {
|
|
6
|
+
res.title = 'Release checklist | Zoho Cliq';
|
|
7
|
+
res.type = 'link';
|
|
8
|
+
res.provider_url = 'https://www.zoho.com/cliq/';
|
|
9
|
+
res.description = 'Release checklist for Cliq 5.0 (Focused on Enterprise and Intelligence)';
|
|
10
|
+
res.dynamic_actions = true;
|
|
11
|
+
|
|
12
|
+
let fields = res.newOembedFields();
|
|
13
|
+
let fieldsData = [];
|
|
14
|
+
fieldsData.push(fields.newOembedFieldData('Created By','Scott fisher'));
|
|
15
|
+
fieldsData.push(fields.newOembedFieldData('Created On', '10 Aug, 2023'));
|
|
16
|
+
fieldsData.push(fields.newOembedFieldData('Last Modified On', '11 Aug, 2023'));
|
|
17
|
+
fieldsData.push(fields.newOembedFieldData('Tags', '#unfurling_via_extensions #images_and_cards #cliq_360 #Cliq_5.0'));
|
|
18
|
+
fields.data = fieldsData;
|
|
19
|
+
res.fields = fields;
|
|
20
|
+
|
|
21
|
+
let actions = [];
|
|
22
|
+
const action = res.newOembedActions();
|
|
23
|
+
action.type = 'button';
|
|
24
|
+
action.label = 'Add Comment';
|
|
25
|
+
const confirm = action.newConfirm();
|
|
26
|
+
confirm.title = 'Comment';
|
|
27
|
+
confirm.description = 'Add your comment to the notes';
|
|
28
|
+
confirm.input = 'Type here...';
|
|
29
|
+
action.confirm = confirm;
|
|
30
|
+
let params = {'action': 'add_comment'};
|
|
31
|
+
action.params = params;
|
|
32
|
+
actions.push(action);
|
|
33
|
+
res.actions = actions;
|
|
34
|
+
|
|
35
|
+
return res;
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
linkPreviewHandler.actionHandler(async (req, res) => {
|
|
39
|
+
const action = req.target.params.action;
|
|
40
|
+
let text;
|
|
41
|
+
if(action === "add_comment")
|
|
42
|
+
{
|
|
43
|
+
text = "Your comment has been added successfully";
|
|
44
|
+
}
|
|
45
|
+
else if(action === "delete_note")
|
|
46
|
+
{
|
|
47
|
+
text = "Release checklist | Zoho Cliq note has been deleted";
|
|
48
|
+
}
|
|
49
|
+
else if(action === "mark_as_favorite")
|
|
50
|
+
{
|
|
51
|
+
text = "Release checklist | Zoho Cliq note has been marked as favorite";
|
|
52
|
+
}
|
|
53
|
+
return res.newBanner(text,'success');
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
linkPreviewHandler.menuHandler(async (req, res) => {
|
|
57
|
+
|
|
58
|
+
let action1 = linkPreviewHandler.newOembedActions('button');
|
|
59
|
+
action1.label = 'Delete';
|
|
60
|
+
action1.params = {'action': 'delete_note'};
|
|
61
|
+
res.push(action1);
|
|
62
|
+
|
|
63
|
+
let action2 = linkPreviewHandler.newOembedActions('button');
|
|
64
|
+
action2.label = 'Mark as Favorite';
|
|
65
|
+
action2.params = {'action': 'mark_as_favorite'};
|
|
66
|
+
res.push(action2);
|
|
67
|
+
|
|
68
|
+
return res;
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
linkPreviewHandler.afterSendHandler(async (req, res) => {
|
|
72
|
+
return res.newBanner('Release checklist | Zoho Cliq 5.0','success');
|
|
73
|
+
});
|
|
@@ -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)
|