@bigbinary/neeto-slack-frontend 3.0.0 → 3.0.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 +326 -279
- package/dist/Configure.js +110 -0
- package/dist/Configure.js.map +1 -0
- package/dist/Connect.js +34 -0
- package/dist/Connect.js.map +1 -0
- package/dist/Field-07124b6f.js +26 -0
- package/dist/Field-07124b6f.js.map +1 -0
- package/dist/Field-3be7830d.js +32 -0
- package/dist/Field-3be7830d.js.map +1 -0
- package/dist/Finish.js +96 -0
- package/dist/Finish.js.map +1 -0
- package/dist/Settings.js +185 -0
- package/dist/Settings.js.map +1 -0
- package/dist/SlackRefreshChannelListButton-84bf0344.js +102 -0
- package/dist/SlackRefreshChannelListButton-84bf0344.js.map +1 -0
- package/dist/SlackRefreshChannelListButton-95756902.js +72 -0
- package/dist/SlackRefreshChannelListButton-95756902.js.map +1 -0
- package/dist/cjs/Configure.js +120 -0
- package/dist/cjs/Configure.js.map +1 -0
- package/dist/cjs/Connect.js +42 -0
- package/dist/cjs/Connect.js.map +1 -0
- package/dist/{index.cjs.js → cjs/Finish.js} +51 -494
- package/dist/cjs/Finish.js.map +1 -0
- package/dist/cjs/Settings.js +199 -0
- package/dist/cjs/Settings.js.map +1 -0
- package/dist/cjs/hooks.js +13 -0
- package/dist/cjs/hooks.js.map +1 -0
- package/dist/cjs/index.js +43 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/defineProperty-e90a259c.js +43 -0
- package/dist/defineProperty-e90a259c.js.map +1 -0
- package/dist/defineProperty-f3094d6c.js +45 -0
- package/dist/defineProperty-f3094d6c.js.map +1 -0
- package/dist/hooks.js +5 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.js +30 -532
- package/dist/index.js.map +1 -1
- package/dist/inject-css-80a5faa3.js +6 -0
- package/dist/inject-css-80a5faa3.js.map +1 -0
- package/dist/inject-css-c86de496.js +4 -0
- package/dist/inject-css-c86de496.js.map +1 -0
- package/dist/useSlackStatusApi-24367316.js +85 -0
- package/dist/useSlackStatusApi-24367316.js.map +1 -0
- package/dist/useSlackStatusApi-c2dfe381.js +79 -0
- package/dist/useSlackStatusApi-c2dfe381.js.map +1 -0
- package/package.json +15 -2
- package/dist/index.cjs.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
# neeto-slack-nano
|
|
2
2
|
|
|
3
|
-
The `neeto-slack-nano` facilitates the management of slack integration within
|
|
3
|
+
The `neeto-slack-nano` facilitates the management of slack integration within
|
|
4
|
+
neeto applictions. The nano exports the `@bigbinary/neeto-slack-frontend` NPM
|
|
5
|
+
package and `neeto-slack-engine` Rails engine for development.
|
|
4
6
|
|
|
5
7
|
## Contents
|
|
6
8
|
|
|
7
9
|
1. [Development with Host Application](#development-with-host-application)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
- [Engine](#engine)
|
|
11
|
+
- [Installation](#installation)
|
|
12
|
+
- [Frontend package](#frontend-package)
|
|
13
|
+
- [Installation](#installation-1)
|
|
14
|
+
- [Instructions for development](#instructions-for-development)
|
|
15
|
+
- [Components](#components)
|
|
16
|
+
- [Connect](#1-connect)
|
|
17
|
+
- [Configure](#2-configure)
|
|
18
|
+
- [Finish](#3-finish)
|
|
19
|
+
- [Settings](#4-settings)
|
|
20
|
+
- [Hooks](#hooks)
|
|
21
|
+
- [useFetchSlackIntegrationsStatus](#1-usefetchslackintegrationsstatus)
|
|
20
22
|
2. [Instructions for Publishing](#instructions-for-publishing)
|
|
21
23
|
|
|
22
24
|
## Development with Host Application
|
|
@@ -25,6 +27,22 @@ The `neeto-slack-nano` facilitates the management of slack integration within ne
|
|
|
25
27
|
|
|
26
28
|
The Engine is used to support the slack integration within neeto applications.
|
|
27
29
|
|
|
30
|
+
1. Log in to the `NeetoChat` app.
|
|
31
|
+
2. Select or add a workspace.
|
|
32
|
+
3. Allow the app to access the Slack workspace.
|
|
33
|
+
4. You will be redirected to a broken page, change `https` to `http` in the URL
|
|
34
|
+
and replace `spinkart` with your workspace name (e.g., "neetochattest"), then
|
|
35
|
+
press Enter.
|
|
36
|
+
|
|
37
|
+
<img width="1144" alt="" src="https://github.com/user-attachments/assets/7a39445f-bf2e-49d2-a92e-d0bec1faf6e2">
|
|
38
|
+
|
|
39
|
+
5. Configure the page by selecting the Slack channel for tickets and click
|
|
40
|
+
`Continue`.
|
|
41
|
+
6. Proceed to the `Finish` step.
|
|
42
|
+
7. Click `Done` to go to the homepage, where you can manage or disconnect Slack.
|
|
43
|
+
|
|
44
|
+
[demo video](https://github.com/user-attachments/assets/d64b57ac-c5bd-4ef3-b4c3-b975fe84ee1e)
|
|
45
|
+
|
|
28
46
|
#### Installation
|
|
29
47
|
|
|
30
48
|
1. Add this line to your application's Gemfile:
|
|
@@ -52,8 +70,8 @@ The Engine is used to support the slack integration within neeto applications.
|
|
|
52
70
|
|
|
53
71
|
4. Install the migrations
|
|
54
72
|
|
|
55
|
-
Add a migration to add slack_chat_api_key to Organization of host app if
|
|
56
|
-
|
|
73
|
+
Add a migration to add slack_chat_api_key to Organization of host app if it
|
|
74
|
+
doesn't exist already. Then run
|
|
57
75
|
|
|
58
76
|
```ruby
|
|
59
77
|
# frozen_string_literal: true
|
|
@@ -76,35 +94,41 @@ The Engine is used to support the slack integration within neeto applications.
|
|
|
76
94
|
has_one :slack_team, as: :integrable, class_name: "NeetoSlackEngine::SlackTeam", dependent: :destroy
|
|
77
95
|
```
|
|
78
96
|
|
|
79
|
-
6. Configure the following `Environment Variables` and `Secrets` with suitable
|
|
97
|
+
6. Configure the following `Environment Variables` and `Secrets` with suitable
|
|
98
|
+
values
|
|
80
99
|
|
|
81
|
-
|
|
100
|
+
- Under `.env` file:
|
|
82
101
|
|
|
83
|
-
|
|
84
|
-
|
|
102
|
+
```yaml
|
|
103
|
+
SLACK_CLIENT_ID=# Value from Slack App console at
|
|
104
|
+
https://api.slack.com/apps/APP_ID/general
|
|
85
105
|
|
|
86
|
-
|
|
106
|
+
SLACK_CLIENT_SECRET=# Valuefrom Slack App console at
|
|
107
|
+
https://api.slack.com/apps/APP_ID/general
|
|
87
108
|
|
|
88
|
-
|
|
109
|
+
SLACK_CLIENT_SIGNING_SECRET=# Value from Slack App console at
|
|
110
|
+
https://api.slack.com/apps/APP_ID/general
|
|
89
111
|
|
|
90
|
-
|
|
112
|
+
ATTR_ENCRYPTION_KEY=# Random varying char. key with min. 32 chars.
|
|
91
113
|
|
|
92
|
-
|
|
114
|
+
SLACK_REDIRECT_PATH=#Path controller if Callbacks controller of the
|
|
115
|
+
application is to be used instead of the one in Engine
|
|
93
116
|
|
|
94
|
-
|
|
95
|
-
|
|
117
|
+
SLACK_HOST_URL=# Host url if different than application host URL or in
|
|
118
|
+
development for use of Ngrok
|
|
119
|
+
```
|
|
96
120
|
|
|
97
|
-
|
|
121
|
+
- Under `secrets.yml` file:
|
|
98
122
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
123
|
+
```yaml
|
|
124
|
+
application_name: # Application name
|
|
125
|
+
attr_encrypted:
|
|
126
|
+
encryption_key: <%= ENV['ATTR_ENCRYPTION_KEY'] %>
|
|
127
|
+
slack:
|
|
128
|
+
client_id: "<%= ENV['SLACK_CLIENT_ID'] %>"
|
|
129
|
+
client_secret: <%= ENV['SLACK_CLIENT_SECRET'] %>
|
|
130
|
+
client_signing_secret: <%= ENV['SLACK_CLIENT_SIGNING_SECRET'] %>
|
|
131
|
+
```
|
|
108
132
|
|
|
109
133
|
7. Slack Integration supports customizing scopes required for host app on usage
|
|
110
134
|
basis, for adding/removing the scope file with name `neeto_slack_engine.yml`
|
|
@@ -134,7 +158,8 @@ The Engine is used to support the slack integration within neeto applications.
|
|
|
134
158
|
|
|
135
159
|
### Frontend package
|
|
136
160
|
|
|
137
|
-
The package exports components and hooks to manage slack integration within
|
|
161
|
+
The package exports components and hooks to manage slack integration within
|
|
162
|
+
neeto applications.
|
|
138
163
|
|
|
139
164
|
#### Installation
|
|
140
165
|
|
|
@@ -146,7 +171,9 @@ yarn add @bigbinary/neeto-slack-frontend
|
|
|
146
171
|
|
|
147
172
|
#### Instructions for development
|
|
148
173
|
|
|
149
|
-
Check the
|
|
174
|
+
Check the
|
|
175
|
+
[Frontend package development guide](https://neeto-engineering.neetokb.com/p/a-d34cb4b0)
|
|
176
|
+
for step-by-step instructions to develop the frontend package.
|
|
150
177
|
|
|
151
178
|
### Components
|
|
152
179
|
|
|
@@ -156,9 +183,11 @@ Check the [Frontend package development guide](https://neeto-engineering.neetokb
|
|
|
156
183
|
|
|
157
184
|
##### Props
|
|
158
185
|
|
|
159
|
-
1. `handleRedirectToSlack`: Function to handle the redirect to the slack OAuth
|
|
186
|
+
1. `handleRedirectToSlack`: Function to handle the redirect to the slack OAuth
|
|
187
|
+
url
|
|
160
188
|
|
|
161
|
-
2. `isAuthorizeUrlFetching`: Boolean which handles the loading state of Slack
|
|
189
|
+
2. `isAuthorizeUrlFetching`: Boolean which handles the loading state of Slack
|
|
190
|
+
Authorize button
|
|
162
191
|
|
|
163
192
|
##### Usage
|
|
164
193
|
|
|
@@ -191,7 +220,8 @@ References:
|
|
|
191
220
|
|
|
192
221
|
2. `teamName`: A string representing the Slack team name to be displayed.
|
|
193
222
|
|
|
194
|
-
3. `initialFormValues`: An object containing the initial values for the formik
|
|
223
|
+
3. `initialFormValues`: An object containing the initial values for the formik
|
|
224
|
+
form fields.
|
|
195
225
|
|
|
196
226
|
4. `handleSubmit`: A function to handle the form submit.
|
|
197
227
|
|
|
@@ -200,11 +230,15 @@ References:
|
|
|
200
230
|
6. `className`: A string to add custom styles to the `Configure` component.
|
|
201
231
|
|
|
202
232
|
7. `validationSchema`: A yup validation schema to validate the form fields.
|
|
203
|
-
>>Note: No need to include selectedChannel validation. Also no need to wrap validationSchema in yup.object().shape({..}))
|
|
204
233
|
|
|
205
|
-
|
|
234
|
+
> > Note: No need to include selectedChannel validation. Also no need to wrap
|
|
235
|
+
> > validationSchema in yup.object().shape({..}))
|
|
236
|
+
|
|
237
|
+
8. `channelRefreshHandler`: A function to invalidate queries for refreshing
|
|
238
|
+
Slack Channel list.
|
|
206
239
|
|
|
207
|
-
9. `channelSelectLabel`: A string to customize the label for Slack Channel
|
|
240
|
+
9. `channelSelectLabel`: A string to customize the label for Slack Channel
|
|
241
|
+
select field.
|
|
208
242
|
|
|
209
243
|
10. `slackUrl`: Slack workspace url to be displayed.
|
|
210
244
|
|
|
@@ -212,98 +246,98 @@ References:
|
|
|
212
246
|
|
|
213
247
|
- Without Children
|
|
214
248
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
249
|
+
```js
|
|
250
|
+
<Configure
|
|
251
|
+
handleSubmit={handleSubmit}
|
|
252
|
+
isSubmitting={isSubmitting}
|
|
253
|
+
teamName={teamName}
|
|
254
|
+
initialFormValues={{
|
|
255
|
+
selectedChannel: findBy({ value: selectedChannelId }, channelOptions),
|
|
256
|
+
channels: channelOptions,
|
|
257
|
+
}}
|
|
258
|
+
/>
|
|
259
|
+
```
|
|
226
260
|
|
|
227
|
-
|
|
261
|
+
References:
|
|
228
262
|
|
|
229
|
-
|
|
263
|
+
- [neetoForm](https://github.com/bigbinary/neeto-form-web/blob/b53d660223d124feb87c4a98e64e6b42f8ee1388/app/javascript/src/components/Form/Settings/Integrations/Slack/Steps/Configure.jsx#L19)
|
|
230
264
|
|
|
231
265
|
- With Children
|
|
232
266
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
267
|
+
```js
|
|
268
|
+
const SLACK_SETTING_FORM_VALIDATION_SCHEMA = {
|
|
269
|
+
slackEvents: yup.object().nullable().shape({
|
|
270
|
+
faultOccurred: yup.boolean(),
|
|
271
|
+
faultResolved: yup.boolean(),
|
|
272
|
+
faultUnresolved: yup.boolean(),
|
|
273
|
+
}),
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
// ...
|
|
277
|
+
|
|
278
|
+
<Configure
|
|
279
|
+
handleSubmit={handleSubmit}
|
|
280
|
+
isSubmitting={isSubmitting}
|
|
281
|
+
teamName={teamName}
|
|
282
|
+
validationSchema={SLACK_SETTING_FORM_VALIDATION_SCHEMA}
|
|
283
|
+
initialFormValues={{
|
|
284
|
+
selectedChannel: findBy({ value: notificationChannelId }, channelOptions),
|
|
285
|
+
channels: channelOptions,
|
|
286
|
+
slackEvents: slackEvents,
|
|
287
|
+
}}
|
|
288
|
+
>
|
|
289
|
+
<Checkbox
|
|
290
|
+
className="neeto-ui-mt-5"
|
|
291
|
+
label="Fault Resolved"
|
|
292
|
+
name="slackEvents.faultResolved"
|
|
293
|
+
/>
|
|
294
|
+
<Checkbox
|
|
295
|
+
className="neeto-ui-mt-5"
|
|
296
|
+
label="Fault Unresolved"
|
|
297
|
+
name="slackEvents.faultUnresolved"
|
|
298
|
+
/>
|
|
299
|
+
<Checkbox
|
|
300
|
+
className="neeto-ui-my-5"
|
|
301
|
+
label="Fault Occurred"
|
|
302
|
+
name="slackEvents.faultOccurred"
|
|
303
|
+
/>
|
|
304
|
+
</Configure>;
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
Notes:
|
|
308
|
+
|
|
309
|
+
- You can provide the validation schema for the child form fields.
|
|
276
310
|
|
|
277
311
|
- Accessing formik props
|
|
278
312
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
313
|
+
```js
|
|
314
|
+
<Configure
|
|
315
|
+
handleSubmit={handleSubmit}
|
|
316
|
+
initialFormValues={initialFormValues}
|
|
317
|
+
isSubmitting={isSubmitting}
|
|
318
|
+
teamName={teamName}
|
|
319
|
+
>
|
|
320
|
+
{({ setFieldValue }) => (
|
|
321
|
+
<div className="mb-4 w-full">
|
|
322
|
+
<TimePicker
|
|
323
|
+
use12Hours
|
|
324
|
+
className="text-base font-semibold text-gray-800"
|
|
325
|
+
format="h A"
|
|
326
|
+
interval={{ hourStep: 1, minuteStep: 60, secondStep: 60 }}
|
|
327
|
+
label="Schedule time"
|
|
328
|
+
name="notifyTime"
|
|
329
|
+
type="time"
|
|
330
|
+
onChange={notifyTime => setFieldValue("notifyTime", notifyTime)}
|
|
331
|
+
/>
|
|
332
|
+
</div>
|
|
333
|
+
)}
|
|
334
|
+
</Configure>
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
References:
|
|
338
|
+
|
|
339
|
+
- [neetoInvoice](https://github.com/bigbinary/neeto-invoice-web/pull/3403/files#diff-92b6ca3b40c8f180f2585ba83e1fafda5b31e406298cae613b8c988ff7739e58R32)
|
|
340
|
+
- [neetoChat](https://github.com/bigbinary/neeto-chat-web/blob/baa524d4c48f7acd7d6a4f0c868f21fae3e8ac12/app/javascript/src/components/Settings/Integrations/Slack/Steps/Configure.jsx#L36)
|
|
307
341
|
|
|
308
342
|
#### 3. `Finish`
|
|
309
343
|
|
|
@@ -317,74 +351,75 @@ References:
|
|
|
317
351
|
|
|
318
352
|
3. `buttonProps`: Props for the primary button.
|
|
319
353
|
|
|
320
|
-
|
|
354
|
+
4. `teamName`: A string representing the Slack team name to be displayed.
|
|
321
355
|
|
|
322
|
-
|
|
356
|
+
5. `fields`: An array of objects containing the fields to be displayed.
|
|
323
357
|
|
|
324
|
-
|
|
358
|
+
6. `onBack`: Function that handles redirect to Configure page.
|
|
325
359
|
|
|
326
|
-
|
|
360
|
+
7. `onSuccess`: Function that handles the success case. For example: if there is
|
|
361
|
+
a demo step, then onSuccess would forward the user to the demo step
|
|
327
362
|
|
|
328
363
|
##### Usage
|
|
329
364
|
|
|
330
365
|
1. Without Children
|
|
331
366
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
367
|
+
```js
|
|
368
|
+
const selectedChannel = "General";
|
|
369
|
+
const { configuration } = useSlackApi();
|
|
370
|
+
|
|
371
|
+
return (
|
|
372
|
+
<Finish
|
|
373
|
+
selectedChannel={selectedChannel}
|
|
374
|
+
teamName={configuration.teamName}
|
|
375
|
+
fields={[
|
|
376
|
+
{
|
|
377
|
+
name: "Name",
|
|
378
|
+
value: configuration.name,
|
|
379
|
+
},
|
|
380
|
+
]}
|
|
381
|
+
secondaryButtonProps={{
|
|
382
|
+
label: "Edit",
|
|
383
|
+
onClick: () => setActiveTab("configure"),
|
|
384
|
+
}}
|
|
385
|
+
buttonProps={{ label: "Finish", onClick: onClose }}
|
|
386
|
+
/>
|
|
387
|
+
);
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
References:
|
|
391
|
+
|
|
392
|
+
- [neetoForm](https://github.com/bigbinary/neeto-form-web/blob/b53d660223d124feb87c4a98e64e6b42f8ee1388/app/javascript/src/components/Form/Settings/Integrations/Slack/StepsModal.jsx#L101)
|
|
393
|
+
- [neetoChat](https://github.com/bigbinary/neeto-chat-web/blob/baa524d4c48f7acd7d6a4f0c868f21fae3e8ac12/app/javascript/src/components/Settings/Integrations/Slack/index.jsx#L82)
|
|
359
394
|
|
|
360
395
|
2. With Children
|
|
361
396
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
397
|
+
```js
|
|
398
|
+
const selectedChannel = "General";
|
|
399
|
+
const { configuration } = useSlackApi();
|
|
400
|
+
|
|
401
|
+
return (
|
|
402
|
+
<Finish
|
|
403
|
+
selectedChannel={selectedChannel}
|
|
404
|
+
teamName={configuration.teamName}
|
|
405
|
+
fields={[
|
|
406
|
+
{
|
|
407
|
+
name: "Name",
|
|
408
|
+
value: configuration.name,
|
|
409
|
+
},
|
|
410
|
+
]}
|
|
411
|
+
secondaryButtonProps={{
|
|
412
|
+
label: "Edit",
|
|
413
|
+
onClick: () => setActiveTab("configure"),
|
|
414
|
+
}}
|
|
415
|
+
buttonProps={{ label: "Finish", onClick: onClose }}
|
|
416
|
+
>
|
|
417
|
+
<p className="neeto-ui-my-2 neeto-ui-text-info-800">
|
|
418
|
+
*You can update your info later from settings*
|
|
419
|
+
</p>
|
|
420
|
+
</Finish>
|
|
421
|
+
);
|
|
422
|
+
```
|
|
388
423
|
|
|
389
424
|
#### 4. `Settings`
|
|
390
425
|
|
|
@@ -410,17 +445,22 @@ References:
|
|
|
410
445
|
|
|
411
446
|
1. `children`: Extra form fields to be included in the EditPane.
|
|
412
447
|
|
|
413
|
-
2. `initialFormValues`: An object containing the initial values for the formik
|
|
414
|
-
|
|
448
|
+
2. `initialFormValues`: An object containing the initial values for the formik
|
|
449
|
+
form fields.
|
|
450
|
+
|
|
451
|
+
> Include channels array & selectedChannel value
|
|
415
452
|
|
|
416
453
|
3. `handleSubmit`: A function to handle the form submission.
|
|
417
454
|
|
|
418
455
|
4. `isSubmitting`: A boolean to handle the submitting state of the form.
|
|
419
456
|
|
|
420
|
-
5. `className`: A string to add custom styles to the `Settings.EditPane`
|
|
457
|
+
5. `className`: A string to add custom styles to the `Settings.EditPane`
|
|
458
|
+
component.
|
|
421
459
|
|
|
422
460
|
6. `validationSchema`: A yup validation schema to validate the form fields.
|
|
423
|
-
|
|
461
|
+
|
|
462
|
+
> No need to include selectedChannel validation. Also no need to wrap
|
|
463
|
+
> validationSchema in yup.object().shape({..})
|
|
424
464
|
|
|
425
465
|
7. `onClose`: Function to close the `Pane` when the Close button is clicked.
|
|
426
466
|
|
|
@@ -428,7 +468,8 @@ References:
|
|
|
428
468
|
|
|
429
469
|
9. `isPaneOpen`: A boolean to handle the open/close state of the `Pane`.
|
|
430
470
|
|
|
431
|
-
10. `channelRefreshHandler`: A function to invalidate queries for refreshing
|
|
471
|
+
10. `channelRefreshHandler`: A function to invalidate queries for refreshing
|
|
472
|
+
Slack Channel list.
|
|
432
473
|
|
|
433
474
|
11. `paneProps`: Pass down props to the neeto-ui pane
|
|
434
475
|
|
|
@@ -436,83 +477,83 @@ References:
|
|
|
436
477
|
|
|
437
478
|
1. Basic
|
|
438
479
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
480
|
+
```js
|
|
481
|
+
const [isPaneOpen, setIsPaneOpen] = useState(false);
|
|
482
|
+
|
|
483
|
+
const SETTINGS_FORM_INITIAL_VALUES = {
|
|
484
|
+
channels: [
|
|
485
|
+
{ label: "general", value: "K87KJHKS987" },
|
|
486
|
+
{ label: "hq", value: "IJHKJ76889H" },
|
|
487
|
+
],
|
|
488
|
+
selectedChannel: { label: "general", value: "K87KJHKS987" },
|
|
489
|
+
updateType: "All conversation activity"
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
const { slack, handleSubmit, isSubmitting } = useSlackApi();
|
|
493
|
+
const SETTINGS_FORM_VALIDATION_SCHEMA = {
|
|
494
|
+
updateType: yup.string().required(),
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
return (
|
|
498
|
+
<Settings
|
|
499
|
+
teamName={slack.teamName}
|
|
500
|
+
className="neeto-ui-my-2"
|
|
501
|
+
fields={[
|
|
502
|
+
{
|
|
503
|
+
name: "Channel",
|
|
504
|
+
value: slack.selectedChannel
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
name; "Update Type",
|
|
508
|
+
value: slack.updateType
|
|
509
|
+
}
|
|
510
|
+
]}
|
|
511
|
+
onEdit={() => setIsPaneOpen(true)}
|
|
512
|
+
>
|
|
513
|
+
<Settings.EditPane
|
|
514
|
+
initialFormValues={SETTINGS_FORM_INITIAL_VALUES}
|
|
515
|
+
handleSubmit={handleSubmit}
|
|
516
|
+
isSubmitting={isSubmitting}
|
|
517
|
+
className="neeto-ui-my-2"
|
|
518
|
+
validationSchema={SETTINGS_FORM_VALIDATION_SCHEMA}
|
|
519
|
+
onClose={() => setIsPaneOpen(false)}
|
|
520
|
+
title="Edit slack integration"
|
|
521
|
+
isPaneOpen={isPaneOpen}
|
|
522
|
+
>
|
|
523
|
+
{(formikProps) => (
|
|
524
|
+
<Input name="UpdateType" value={formikProps.values.name} className="neeto-ui-my-2" />
|
|
525
|
+
)}
|
|
526
|
+
</Settings.EditPane>
|
|
527
|
+
</Settings>;
|
|
528
|
+
);
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
References:
|
|
532
|
+
|
|
533
|
+
- [neetoDesk](https://github.com/bigbinary/neeto-desk-web/blob/4da743947603e1f9890ae80bba8e7256c3918278/app/javascript/src/components/Settings/Integrations/Slack/Manage.jsx#L82)
|
|
493
534
|
|
|
494
535
|
2. Accessing formik props for child field elements
|
|
495
536
|
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
537
|
+
```js
|
|
538
|
+
<Settings teamName={teamName} onEdit={handleOpenPane} fields={fields}>
|
|
539
|
+
<Settings.EditPane>
|
|
540
|
+
{({ setFieldValue }) => (
|
|
541
|
+
<div className="mb-4 w-full">
|
|
542
|
+
<TimePicker
|
|
543
|
+
use12Hours
|
|
544
|
+
disabled={isDisabled}
|
|
545
|
+
className="text-base font-semibold text-gray-800"
|
|
546
|
+
format="h A"
|
|
547
|
+
interval={{ hourStep: 1, minuteStep: 60, secondStep: 60 }}
|
|
548
|
+
label="Schedule time"
|
|
549
|
+
name="notifyTime"
|
|
550
|
+
type="time"
|
|
551
|
+
onChange={notifyTime => setFieldValue("notifyTime", notifyTime)}
|
|
552
|
+
/>
|
|
553
|
+
</div>
|
|
554
|
+
)}
|
|
555
|
+
</Settings.EditPane>
|
|
556
|
+
```
|
|
516
557
|
|
|
517
558
|
### Hooks
|
|
518
559
|
|
|
@@ -522,35 +563,41 @@ This is a React Query hook for fetching the status of slack integration.
|
|
|
522
563
|
|
|
523
564
|
##### Arguments
|
|
524
565
|
|
|
525
|
-
- `integrableId`: Query param required to fetch Integration connect status
|
|
526
|
-
|
|
566
|
+
- `integrableId`: Query param required to fetch Integration connect status
|
|
567
|
+
through Integrable, passing the record id which is used as integrable for
|
|
568
|
+
Slack Integration
|
|
569
|
+
- `integrableType`: Query param required to fetch Integration connect status
|
|
570
|
+
through Integrable, passing the record type which is used as integrable for
|
|
571
|
+
Slack Integration.
|
|
527
572
|
|
|
528
573
|
##### Usage
|
|
529
574
|
|
|
530
575
|
1. ##### Without Integrable params
|
|
531
576
|
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
577
|
+
```js
|
|
578
|
+
const { data: { isSlackIntegrated = "", notificationChannel = "" } = {} } =
|
|
579
|
+
useFetchSlackIntegrationsStatus({});
|
|
580
|
+
```
|
|
536
581
|
|
|
537
|
-
|
|
582
|
+
References:
|
|
538
583
|
|
|
539
|
-
|
|
584
|
+
- [neetoDesk](https://github.com/bigbinary/neeto-desk-web/blob/4da743947603e1f9890ae80bba8e7256c3918278/app/javascript/src/components/Settings/Integrations/Slack/index.jsx#L35)
|
|
540
585
|
|
|
541
586
|
2. ##### With Integrable params
|
|
542
587
|
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
588
|
+
```js
|
|
589
|
+
const { data: { isSlackIntegrated = "", notificationChannel = "" } = {} } =
|
|
590
|
+
useFetchSlackIntegrationsStatus({
|
|
591
|
+
integrableId: "1234567890",
|
|
592
|
+
integrableType: "Form",
|
|
593
|
+
});
|
|
594
|
+
```
|
|
550
595
|
|
|
551
596
|
## Instructions for Publishing
|
|
552
597
|
|
|
553
|
-
Consult the
|
|
598
|
+
Consult the
|
|
599
|
+
[building and releasing packages](https://neeto-engineering.neetokb.com/articles/building-and-releasing-packages)
|
|
600
|
+
guide for details on how to publish.
|
|
554
601
|
|
|
555
602
|
<br>
|
|
556
603
|
|