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
|
@@ -14,6 +14,7 @@ import org.json.JSONObject;
|
|
|
14
14
|
|
|
15
15
|
import com.zc.cliq.enums.ACTION_TYPE;
|
|
16
16
|
import com.zc.cliq.enums.BANNER_STATUS;
|
|
17
|
+
import com.zc.cliq.enums.FORM_FIELD_TEXT_FORMAT;
|
|
17
18
|
import com.zc.cliq.enums.FORM_FIELD_TYPE;
|
|
18
19
|
import com.zc.cliq.enums.FORM_MODIFICATION_ACTION_TYPE;
|
|
19
20
|
import com.zc.cliq.enums.SLIDE_TYPE;
|
|
@@ -25,6 +26,7 @@ import com.zc.cliq.objects.ButtonObject;
|
|
|
25
26
|
import com.zc.cliq.objects.CardDetails;
|
|
26
27
|
import com.zc.cliq.objects.Form;
|
|
27
28
|
import com.zc.cliq.objects.FormAction;
|
|
29
|
+
import com.zc.cliq.objects.FormActionsObject;
|
|
28
30
|
import com.zc.cliq.objects.FormChangeResponse;
|
|
29
31
|
import com.zc.cliq.objects.FormDynamicFieldResponse;
|
|
30
32
|
import com.zc.cliq.objects.FormInput;
|
|
@@ -39,9 +41,14 @@ import com.zc.cliq.objects.WidgetFooter;
|
|
|
39
41
|
import com.zc.cliq.objects.WidgetHeader;
|
|
40
42
|
import com.zc.cliq.objects.WidgetResponse;
|
|
41
43
|
import com.zc.cliq.objects.WidgetSection;
|
|
44
|
+
import com.zc.cliq.objects.WidgetTarget;
|
|
42
45
|
import com.zc.cliq.requests.ButtonFunctionRequest;
|
|
43
46
|
import com.zc.cliq.requests.FormFunctionRequest;
|
|
44
47
|
import com.zc.cliq.requests.WidgetFunctionRequest;
|
|
48
|
+
import com.zc.cliq.responses.ButtonFunctionResponse;
|
|
49
|
+
import com.zc.cliq.responses.FormChangeHandlerResponse;
|
|
50
|
+
import com.zc.cliq.responses.FormSubmitResponse;
|
|
51
|
+
import com.zc.cliq.responses.WidgetButtonResponse;
|
|
45
52
|
import com.zc.cliq.util.ZCCliqUtil;
|
|
46
53
|
|
|
47
54
|
public class FunctionHandler implements com.zc.cliq.interfaces.FunctionHandler {
|
|
@@ -49,13 +56,13 @@ public class FunctionHandler implements com.zc.cliq.interfaces.FunctionHandler {
|
|
|
49
56
|
Logger LOGGER = Logger.getLogger(FunctionHandler.class.getName());
|
|
50
57
|
|
|
51
58
|
@Override
|
|
52
|
-
public
|
|
59
|
+
public ButtonFunctionResponse buttonFunctionHandler(ButtonFunctionRequest req) throws Exception {
|
|
53
60
|
Message msg = Message.getInstance("Button function executed");
|
|
54
|
-
return
|
|
61
|
+
return msg;
|
|
55
62
|
}
|
|
56
63
|
|
|
57
64
|
@Override
|
|
58
|
-
public
|
|
65
|
+
public FormSubmitResponse formSubmitHandler(FormFunctionRequest req) throws Exception {
|
|
59
66
|
JSONObject values = req.getForm().getValues();
|
|
60
67
|
|
|
61
68
|
String type = values.optString("type", null);
|
|
@@ -81,7 +88,7 @@ public class FunctionHandler implements com.zc.cliq.interfaces.FunctionHandler {
|
|
|
81
88
|
WidgetSection buttonSection = getButtonsSection();
|
|
82
89
|
widgetResp.addSection(buttonSection);
|
|
83
90
|
|
|
84
|
-
return
|
|
91
|
+
return widgetResp;
|
|
85
92
|
} else if (type.equals("formsection")) {
|
|
86
93
|
WidgetSection section = WidgetSection.getInstance();
|
|
87
94
|
section.setId("102");
|
|
@@ -90,11 +97,11 @@ public class FunctionHandler implements com.zc.cliq.interfaces.FunctionHandler {
|
|
|
90
97
|
editedBy.setText("Edited by " + values.optString("text") + " :wink:");
|
|
91
98
|
section.addElement(editedBy);
|
|
92
99
|
|
|
93
|
-
return
|
|
100
|
+
return section;
|
|
94
101
|
} else {
|
|
95
102
|
Message msg = Message.getInstance("Applet Button executed successfully");
|
|
96
103
|
msg.setBannerResponse(BANNER_STATUS.SUCCESS);
|
|
97
|
-
return
|
|
104
|
+
return msg;
|
|
98
105
|
}
|
|
99
106
|
}
|
|
100
107
|
String text = new StringBuilder().append("Hi ").append(values.getString("username")).append(", thanks for raising your request. Your request will be processed based on the device availability.").toString();
|
|
@@ -121,11 +128,11 @@ public class FunctionHandler implements com.zc.cliq.interfaces.FunctionHandler {
|
|
|
121
128
|
}
|
|
122
129
|
slide.setData(dataArray);
|
|
123
130
|
msg.addSlide(slide);
|
|
124
|
-
return
|
|
131
|
+
return msg;
|
|
125
132
|
}
|
|
126
133
|
|
|
127
134
|
@Override
|
|
128
|
-
public
|
|
135
|
+
public FormChangeHandlerResponse formChangeHandler(FormFunctionRequest req) throws Exception {
|
|
129
136
|
FormChangeResponse resp = FormChangeResponse.getInstance();
|
|
130
137
|
String target = req.getTarget().getName();
|
|
131
138
|
JSONObject values = req.getForm().getValues();
|
|
@@ -136,7 +143,7 @@ public class FunctionHandler implements com.zc.cliq.interfaces.FunctionHandler {
|
|
|
136
143
|
FormModificationAction selectBoxAction = FormModificationAction.getInstance();
|
|
137
144
|
selectBoxAction.setType(FORM_MODIFICATION_ACTION_TYPE.ADD_AFTER);
|
|
138
145
|
selectBoxAction.setName("asset-type");
|
|
139
|
-
FormInput OS = FormInput.
|
|
146
|
+
FormInput OS = FormInput.getInstance();
|
|
140
147
|
OS.setTriggerOnChange(true);
|
|
141
148
|
OS.setType(FORM_FIELD_TYPE.SELECT);
|
|
142
149
|
OS.setName("os-type");
|
|
@@ -173,7 +180,7 @@ public class FunctionHandler implements com.zc.cliq.interfaces.FunctionHandler {
|
|
|
173
180
|
FormModificationAction selectBoxAction = FormModificationAction.getInstance();
|
|
174
181
|
selectBoxAction.setType(FORM_MODIFICATION_ACTION_TYPE.ADD_AFTER);
|
|
175
182
|
selectBoxAction.setName("asset-type");
|
|
176
|
-
FormInput OS = FormInput.
|
|
183
|
+
FormInput OS = FormInput.getInstance();
|
|
177
184
|
OS.setTriggerOnChange(true);
|
|
178
185
|
OS.setType(FORM_FIELD_TYPE.SELECT);
|
|
179
186
|
OS.setName("mobile-os");
|
|
@@ -205,7 +212,7 @@ public class FunctionHandler implements com.zc.cliq.interfaces.FunctionHandler {
|
|
|
205
212
|
FormModificationAction mobileListAction = FormModificationAction.getInstance();
|
|
206
213
|
mobileListAction.setType(FORM_MODIFICATION_ACTION_TYPE.ADD_AFTER);
|
|
207
214
|
mobileListAction.setName("mobile-os");
|
|
208
|
-
FormInput listInput = FormInput.
|
|
215
|
+
FormInput listInput = FormInput.getInstance();
|
|
209
216
|
listInput.setType(FORM_FIELD_TYPE.DYNAMIC_SELECT);
|
|
210
217
|
listInput.setName("mobile-list");
|
|
211
218
|
listInput.setLabel("Mobile Device");
|
|
@@ -240,10 +247,55 @@ public class FunctionHandler implements com.zc.cliq.interfaces.FunctionHandler {
|
|
|
240
247
|
}
|
|
241
248
|
return resp;
|
|
242
249
|
}
|
|
250
|
+
|
|
251
|
+
@Override
|
|
252
|
+
public Form formViewHandler(FormFunctionRequest req) throws Exception {
|
|
253
|
+
Form form = Form.getInstance();
|
|
254
|
+
form.setTitle("Asset Request");
|
|
255
|
+
form.setHint("Raise your asset request");
|
|
256
|
+
form.setName("ID");
|
|
257
|
+
form.setButtonLabel("Raise Request");
|
|
258
|
+
form.setVersion(1);
|
|
259
|
+
|
|
260
|
+
FormInput username = FormInput.getInstance();
|
|
261
|
+
username.setType(FORM_FIELD_TYPE.TEXT);
|
|
262
|
+
username.setName("username");
|
|
263
|
+
username.setLabel("Name");
|
|
264
|
+
username.setHint("Please enter your name");
|
|
265
|
+
username.setPlaceholder("John Reese");
|
|
266
|
+
username.setMandatory(true);
|
|
267
|
+
username.setValue("Harold Finch");
|
|
268
|
+
form.addFormInput(username);
|
|
269
|
+
|
|
270
|
+
FormInput email = FormInput.getInstance();
|
|
271
|
+
email.setType(FORM_FIELD_TYPE.TEXT);
|
|
272
|
+
email.setFormat(FORM_FIELD_TEXT_FORMAT.EMAIL);
|
|
273
|
+
email.setName("email");
|
|
274
|
+
email.setLabel("Email");
|
|
275
|
+
email.setHint("Enter your email address");
|
|
276
|
+
email.setPlaceholder("johnreese@poi.com");
|
|
277
|
+
email.setMandatory(true);
|
|
278
|
+
email.setValue("haroldfinch@samaritan.com");
|
|
279
|
+
form.addFormInput(email);
|
|
280
|
+
|
|
281
|
+
FormInput assetType = FormInput.getInstance();
|
|
282
|
+
assetType.setType(FORM_FIELD_TYPE.SELECT);
|
|
283
|
+
assetType.setTriggerOnChange(true);
|
|
284
|
+
assetType.setName("asset-type");
|
|
285
|
+
assetType.setLabel("Asset Type");
|
|
286
|
+
assetType.setHint("Choose your request asset type");
|
|
287
|
+
assetType.setPlaceholder("Mobile");
|
|
288
|
+
assetType.setMandatory(true);
|
|
289
|
+
assetType.addOption(new FormValue("Laptop", "laptop"));
|
|
290
|
+
assetType.addOption(new FormValue("Mobile", "mobile"));
|
|
291
|
+
form.addFormInput(assetType);
|
|
292
|
+
|
|
293
|
+
return form;
|
|
294
|
+
}
|
|
243
295
|
|
|
244
296
|
@Override
|
|
245
|
-
public
|
|
246
|
-
|
|
297
|
+
public WidgetButtonResponse widgetButtonHandler(WidgetFunctionRequest req) throws Exception {
|
|
298
|
+
WidgetTarget target = req.getTarget();
|
|
247
299
|
String id = target.getId();
|
|
248
300
|
switch (id) {
|
|
249
301
|
case "tab": {
|
|
@@ -263,7 +315,7 @@ public class FunctionHandler implements com.zc.cliq.interfaces.FunctionHandler {
|
|
|
263
315
|
WidgetSection buttonSection = getButtonsSection();
|
|
264
316
|
|
|
265
317
|
widgetResp.addSection(buttonSection);
|
|
266
|
-
return
|
|
318
|
+
return widgetResp;
|
|
267
319
|
}
|
|
268
320
|
|
|
269
321
|
case "section": {
|
|
@@ -273,7 +325,7 @@ public class FunctionHandler implements com.zc.cliq.interfaces.FunctionHandler {
|
|
|
273
325
|
WidgetElement element = WidgetElement.getInstance(WIDGET_ELEMENT_TYPE.TITLE);
|
|
274
326
|
element.setText("Edited :wink:");
|
|
275
327
|
section.addElement(element);
|
|
276
|
-
return
|
|
328
|
+
return section;
|
|
277
329
|
}
|
|
278
330
|
|
|
279
331
|
case "formtab":
|
|
@@ -283,16 +335,16 @@ public class FunctionHandler implements com.zc.cliq.interfaces.FunctionHandler {
|
|
|
283
335
|
form.setName("a");
|
|
284
336
|
form.setHint("Register yourself for the Zylker Annual Marathon!");
|
|
285
337
|
form.setButtonLabel("Submit");
|
|
286
|
-
FormInput input1 = FormInput.
|
|
338
|
+
FormInput input1 = FormInput.getInstance();
|
|
287
339
|
input1.setType(FORM_FIELD_TYPE.TEXT);
|
|
288
340
|
input1.setName("text");
|
|
289
341
|
input1.setLabel("Name");
|
|
290
342
|
input1.setPlaceholder("Scott Fischer");
|
|
291
|
-
input1.setMinLength(
|
|
292
|
-
input1.setMaxLength(
|
|
343
|
+
input1.setMinLength(0);
|
|
344
|
+
input1.setMaxLength(25);
|
|
293
345
|
input1.setMandatory(true);
|
|
294
346
|
|
|
295
|
-
FormInput input2 = FormInput.
|
|
347
|
+
FormInput input2 = FormInput.getInstance();
|
|
296
348
|
input2.setType(FORM_FIELD_TYPE.HIDDEN);
|
|
297
349
|
input2.setName("type");
|
|
298
350
|
input2.setValue(id);
|
|
@@ -300,7 +352,7 @@ public class FunctionHandler implements com.zc.cliq.interfaces.FunctionHandler {
|
|
|
300
352
|
form.addFormInput(input1);
|
|
301
353
|
form.addFormInput(input2);
|
|
302
354
|
form.setAction(FormAction.getInstance("appletForm"));// ** ENTER YOUR FORM FUNCTION NAME HERE **
|
|
303
|
-
return
|
|
355
|
+
return form;
|
|
304
356
|
}
|
|
305
357
|
|
|
306
358
|
case "breadcrumbs":
|
|
@@ -350,13 +402,13 @@ public class FunctionHandler implements com.zc.cliq.interfaces.FunctionHandler {
|
|
|
350
402
|
footer.setButtons(footerButtons);
|
|
351
403
|
widgetResp.setFooter(footer);
|
|
352
404
|
|
|
353
|
-
return
|
|
405
|
+
return widgetResp;
|
|
354
406
|
|
|
355
407
|
case "banner":
|
|
356
408
|
default: {
|
|
357
409
|
Message msg = Message.getInstance("Applet Button executed successfully");
|
|
358
410
|
msg.setBannerResponse(BANNER_STATUS.SUCCESS);
|
|
359
|
-
return
|
|
411
|
+
return msg;
|
|
360
412
|
}
|
|
361
413
|
}
|
|
362
414
|
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
//$Id$
|
|
2
|
+
package com.handlers;
|
|
3
|
+
|
|
4
|
+
import java.util.ArrayList;
|
|
5
|
+
import java.util.HashMap;
|
|
6
|
+
import java.util.LinkedList;
|
|
7
|
+
import java.util.List;
|
|
8
|
+
|
|
9
|
+
import com.zc.cliq.enums.BANNER_STATUS;
|
|
10
|
+
import com.zc.cliq.enums.OEMBED_ACTION_TYPE;
|
|
11
|
+
import com.zc.cliq.enums.OEMBED_TYPES;
|
|
12
|
+
import com.zc.cliq.objects.Confirm;
|
|
13
|
+
import com.zc.cliq.objects.OembedActions;
|
|
14
|
+
import com.zc.cliq.objects.OembedFieldData;
|
|
15
|
+
import com.zc.cliq.objects.OembedFields;
|
|
16
|
+
import com.zc.cliq.requests.LinkPreviewHandlerRequest;
|
|
17
|
+
import com.zc.cliq.responses.BannerResponse;
|
|
18
|
+
import com.zc.cliq.responses.CoreResponse;
|
|
19
|
+
import com.zc.cliq.responses.UnfurlResponse;
|
|
20
|
+
|
|
21
|
+
public class LinkPreviewHandler implements com.zc.cliq.interfaces.LinkPreviewHandler {
|
|
22
|
+
|
|
23
|
+
@Override
|
|
24
|
+
public UnfurlResponse previewHandler(LinkPreviewHandlerRequest req) throws Exception {
|
|
25
|
+
UnfurlResponse response = new UnfurlResponse("Release checklist | Zoho Cliq", OEMBED_TYPES.LINK, "https://www.zoho.com/cliq/");
|
|
26
|
+
response.setDescription("Release checklist for Cliq 5.0 (Focused on Enterprise and Intelligence)");
|
|
27
|
+
response.setDynamicActions(true);
|
|
28
|
+
|
|
29
|
+
// Create fields
|
|
30
|
+
List<OembedFieldData> fieldsData = new ArrayList<>();
|
|
31
|
+
fieldsData.add(new OembedFieldData("Created By","Scott fisher"));
|
|
32
|
+
fieldsData.add(new OembedFieldData("Created On", "10 Aug, 2023"));
|
|
33
|
+
fieldsData.add(new OembedFieldData("Last Modified On", "11 Aug, 2023"));
|
|
34
|
+
fieldsData.add(new OembedFieldData("Tags", "#unfurling_via_extensions #images_and_cards #cliq_360 #Cliq_5.0"));
|
|
35
|
+
|
|
36
|
+
OembedFields fields = new OembedFields(null, fieldsData);
|
|
37
|
+
response.setFields(fields);
|
|
38
|
+
|
|
39
|
+
// Create actions
|
|
40
|
+
List<OembedActions> actions = new LinkedList<OembedActions>();
|
|
41
|
+
OembedActions action = new OembedActions(OEMBED_ACTION_TYPE.BUTTON, "Add Comment");
|
|
42
|
+
|
|
43
|
+
Confirm confirm = new Confirm();
|
|
44
|
+
confirm.setTitle("Comment");
|
|
45
|
+
confirm.setDescription("Add your comment to the notes");
|
|
46
|
+
confirm.setInput("Type here...");
|
|
47
|
+
action.setConfirm(confirm);
|
|
48
|
+
|
|
49
|
+
HashMap<String,Object> params = new HashMap<String,Object>();
|
|
50
|
+
params.put("action", "add_comment");
|
|
51
|
+
action.setParams(params);
|
|
52
|
+
|
|
53
|
+
actions.add(action);
|
|
54
|
+
|
|
55
|
+
response.setActions(actions);
|
|
56
|
+
return response;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@Override
|
|
60
|
+
public CoreResponse actionHandler(LinkPreviewHandlerRequest req) throws Exception {
|
|
61
|
+
HashMap<String,Object> target = (HashMap<String, Object>) req.getTarget();
|
|
62
|
+
HashMap<String,Object> params = (HashMap<String, Object>) target.get("params");
|
|
63
|
+
String action = (String) params.get("action");
|
|
64
|
+
String text = null;
|
|
65
|
+
if(action.equals("add_comment"))
|
|
66
|
+
{
|
|
67
|
+
text = "Your comment has been added successfully";
|
|
68
|
+
}
|
|
69
|
+
else if(action.equals("delete_note"))
|
|
70
|
+
{
|
|
71
|
+
text = "Release checklist | Zoho Cliq note has been deleted";
|
|
72
|
+
}
|
|
73
|
+
else if(action.equals("mark_as_favorite"))
|
|
74
|
+
{
|
|
75
|
+
text = "Release checklist | Zoho Cliq note has been marked as favorite";
|
|
76
|
+
}
|
|
77
|
+
BannerResponse banner = new BannerResponse(text, BANNER_STATUS.SUCCESS);
|
|
78
|
+
return banner;
|
|
79
|
+
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@Override
|
|
83
|
+
public List<OembedActions> menuHandler(LinkPreviewHandlerRequest req) throws Exception {
|
|
84
|
+
List<OembedActions> actions = new LinkedList<OembedActions>();
|
|
85
|
+
|
|
86
|
+
OembedActions delete = new OembedActions(OEMBED_ACTION_TYPE.BUTTON,"Delete");
|
|
87
|
+
HashMap<String,Object> deleteParam = new HashMap<String,Object>();
|
|
88
|
+
deleteParam.put("action", "delete_note");
|
|
89
|
+
delete.setParams(deleteParam);
|
|
90
|
+
actions.add(delete);
|
|
91
|
+
|
|
92
|
+
OembedActions favorite = new OembedActions(OEMBED_ACTION_TYPE.BUTTON, "Mark as Favorite");
|
|
93
|
+
HashMap<String,Object> favoriteParams = new HashMap<String,Object>();
|
|
94
|
+
favoriteParams.put("action", "mark_as_favorite");
|
|
95
|
+
favorite.setParams(favoriteParams);
|
|
96
|
+
actions.add(favorite);
|
|
97
|
+
|
|
98
|
+
return actions;
|
|
99
|
+
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@Override
|
|
103
|
+
public CoreResponse afterSendHandler(LinkPreviewHandlerRequest req) throws Exception {
|
|
104
|
+
BannerResponse banner = new BannerResponse("Release checklist | Zoho Cliq 5.0", BANNER_STATUS.SUCCESS);
|
|
105
|
+
return banner;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
}
|
|
@@ -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
|
+
});
|