@bigbinary/neeto-message-templates-frontend 0.3.6 → 0.4.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 +88 -158
- package/app/javascript/src/translations/en.json +17 -12
- package/dist/index.cjs.js +36 -33
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +38 -35
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
# neeto-message-templates
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
# neeto-message-templates-nano
|
|
2
|
+
The `neeto-message-templates-nano` manages message templates across the neeto products. As of now, it supports the creation of SMS, Email and Whatsapp templates. The nano exports the `@bigbinary/neeto-message-templates-frontend` NPM package and `neeto-message-templates-engine` Rails engine for development.
|
|
3
|
+
|
|
4
|
+
# Contents
|
|
5
|
+
1. [Development with Host Application](#development-with-host-application)
|
|
6
|
+
- [Engine](#engine)
|
|
7
|
+
- [Installation](#installation)
|
|
8
|
+
- [Usage](#usage)
|
|
9
|
+
- [Frontend package](#frontend-package)
|
|
10
|
+
- [Installation](#installation-1)
|
|
11
|
+
- [Components](#components)
|
|
12
|
+
2. [Instructions for Publishing](#instructions-for-publishing)
|
|
13
|
+
|
|
14
|
+
# Development with Host Application
|
|
15
|
+
## Engine
|
|
16
|
+
The engine is used to manage message templates across neeto products.
|
|
17
|
+
|
|
18
|
+
### Installation
|
|
8
19
|
1. Add this line to your application's Gemfile:
|
|
9
|
-
|
|
10
|
-
```ruby
|
|
20
|
+
```ruby
|
|
11
21
|
source "NEETO_GEM_SERVER_URL" do
|
|
12
|
-
|
|
22
|
+
# ..existing gems
|
|
13
23
|
|
|
14
|
-
|
|
24
|
+
gem 'neeto-message-templates-engine'
|
|
15
25
|
end
|
|
16
|
-
|
|
17
|
-
|
|
26
|
+
```
|
|
18
27
|
2. And then execute:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
bundle exec rails neeto_message_templates_engine:install:migrations
|
|
41
|
-
bundle exec rails db:migrate
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
6. Create a file in the host app under
|
|
45
|
-
`app/lib/neeto_message_templates_engine/callbacks.rb` & provide the
|
|
46
|
-
permission (If you don't have permissions, then simply return true)
|
|
47
|
-
|
|
48
|
-
```ruby
|
|
28
|
+
```zsh
|
|
29
|
+
bundle install
|
|
30
|
+
```
|
|
31
|
+
3. Add this line to your application's `config/routes.rb` file:
|
|
32
|
+
```ruby
|
|
33
|
+
mount NeetoMessageTemplatesEngine::Engine => "/neeto_message_templates_engine"
|
|
34
|
+
```
|
|
35
|
+
4. Run the following command to copy the migrations from the engine to the host application:
|
|
36
|
+
```zsh
|
|
37
|
+
bundle exec rails neeto_message_templates_engine:install:migrations
|
|
38
|
+
```
|
|
39
|
+
5. Add the migrations to the database:
|
|
40
|
+
```zsh
|
|
41
|
+
bundle exec rails db:migrate
|
|
42
|
+
```
|
|
43
|
+
5. Create file `neeto-message-templates.rb` under `config/initializers` to provide the `owner_class` information
|
|
44
|
+
```ruby
|
|
45
|
+
NeetoFormEngine.owner_class = "Organization"
|
|
46
|
+
```
|
|
47
|
+
6. Create file `callbacks.rb` under `app/lib/neeto_message_templates_engine` and provide the permission (If you don't have permissions, then simply return true)
|
|
48
|
+
```ruby
|
|
49
49
|
module NeetoMessageTemplatesEngine
|
|
50
50
|
class Callbacks
|
|
51
51
|
def self.can_manage_message_templates?(user)
|
|
@@ -53,49 +53,40 @@ the creation of SMS, Email and Whatsapp templates.
|
|
|
53
53
|
end
|
|
54
54
|
end
|
|
55
55
|
end
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
`owner`.
|
|
62
|
-
|
|
63
|
-
```ruby
|
|
64
|
-
NeetoMessageTemplatesEngine.owner_class = "Organization"
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
# Frontend Package Installation
|
|
68
|
-
|
|
69
|
-
Install the latest `neetoMessageTemplates` package using the below command:
|
|
70
|
-
|
|
71
|
-
```shell
|
|
72
|
-
yarn add @bigbinary/neeto-message-templates-frontend
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
## MessageTemplates
|
|
76
|
-
|
|
77
|
-
### Props
|
|
78
|
-
|
|
79
|
-
- `shouldIncludeTestTemplate`: A boolean value to determines whether test
|
|
80
|
-
message template option to be included.
|
|
56
|
+
```
|
|
57
|
+
7. Configure the owner model in the host application.
|
|
58
|
+
```ruby
|
|
59
|
+
has_many :message_templates, as: :owner, class_name: "NeetoMessageTemplatesEngine::MessageTemplate", dependent: :destroy
|
|
60
|
+
```
|
|
81
61
|
|
|
82
|
-
|
|
83
|
-
|
|
62
|
+
### Usage
|
|
63
|
+
You can learn more about usage here:
|
|
64
|
+
1. [Models](/docs/engine/models.md)
|
|
65
|
+
|
|
66
|
+
## Frontend package
|
|
67
|
+
### Installation
|
|
68
|
+
1. Install the latest `neeto-message-templates-nano` package using the below command:
|
|
69
|
+
```zsh
|
|
70
|
+
yarn add @bigbinary/neeto-message-templates-frontend
|
|
71
|
+
```
|
|
84
72
|
|
|
85
|
-
|
|
86
|
-
|
|
73
|
+
### Components
|
|
74
|
+
#### `MessageTemplates` ([source code](https://github.com/bigbinary/neeto-message-templates-nano/blob/80a73223e8facf21a0135675d4dc837645d0f2b0/app/javascript/src/components/MessageTemplates/index.jsx))
|
|
75
|
+
This component is used to manage message templates in your web application. It provides a user-friendly interface for viewing, adding, and editing templates, along with filtering and search capabilities.
|
|
87
76
|
|
|
88
|
-
|
|
77
|
+
##### Props
|
|
78
|
+
- `shouldIncludeTestTemplate`: A boolean indicating whether the test message template option should be included.
|
|
79
|
+
- `handleSubmitTestTemplate`: The function in the host app responsible for submitting values to send test templates for email and SMS.
|
|
80
|
+
- `isTestMessageLoading`: A boolean indicating whether the test template handle submit is in a loading state.
|
|
81
|
+
- `type`: Represents the type of message, with accepted values of `email`, `sms`, or `whatsapp`.
|
|
89
82
|
|
|
83
|
+
##### Optional Props
|
|
90
84
|
- `templateVariables`: (optional) To add dynamic variables to form body field.
|
|
85
|
+
- `ownerId`: (optional) To provide the `ID` of the owner if it is not an Organization model. If the owner is an Organization, this prop can be left unspecified.
|
|
86
|
+
- `breadcrumbs`: An array of objects that specify breadcrumbs for navigation.
|
|
91
87
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
unspecified.
|
|
95
|
-
|
|
96
|
-
### Usage
|
|
97
|
-
|
|
98
|
-
```javascript
|
|
88
|
+
##### Usage
|
|
89
|
+
```jsx
|
|
99
90
|
import React from "react";
|
|
100
91
|
|
|
101
92
|
import { MessageTemplates } from "@bigbinary/neeto-message-templates-frontend";
|
|
@@ -131,36 +122,24 @@ const App = () => {
|
|
|
131
122
|
};
|
|
132
123
|
```
|
|
133
124
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
### Props
|
|
137
|
-
|
|
138
|
-
- `isOpen`: To open the side pane.
|
|
139
|
-
|
|
140
|
-
- `onClose`: To close the side pane.
|
|
125
|
+
#### `SendMessagePane` ([source code](https://github.com/bigbinary/neeto-message-templates-nano/blob/80a73223e8facf21a0135675d4dc837645d0f2b0/app/javascript/src/components/SendMessagePane/index.jsx))
|
|
126
|
+
This component provides a pane where users can select a template and add content to compose and send messages.
|
|
141
127
|
|
|
142
|
-
|
|
143
|
-
|
|
128
|
+
##### Props
|
|
129
|
+
- `isOpen`: A boolean determining whether the side pane is open.
|
|
130
|
+
- `onClose`: The function to execute when closing.
|
|
131
|
+
- `handleSubmit`: The function within the host app used to send SMS and email.
|
|
132
|
+
- `type`: Represents the type of message, with accepted values of `email`, `sms`, or `whatsapp`.
|
|
144
133
|
|
|
145
|
-
|
|
134
|
+
##### Optional Props
|
|
135
|
+
- `customFields`: To add custom field component to the pane.
|
|
136
|
+
- `customFieldsInitialValues`: To provide initial values for the custom fields.
|
|
137
|
+
- `customFieldsValidationSchema`: To provide validation schema for the custom fields.
|
|
138
|
+
- `templateVariables`: To add dynamic variables to form body field.
|
|
139
|
+
- `ownerId`: To provide the `ID` of the owner if it is not an Organization model. If the owner is an Organization, this prop can be left unspecified.
|
|
146
140
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
- `customFieldsInitialValues`: (optional) To provide initial values for the
|
|
150
|
-
custom fields.
|
|
151
|
-
|
|
152
|
-
- `customFieldsValidationSchema`: (optional) To provide validation schema for
|
|
153
|
-
the custom fields.
|
|
154
|
-
|
|
155
|
-
- `templateVariables`: (optional) To add dynamic variables to form body field.
|
|
156
|
-
|
|
157
|
-
- `ownerId`: (optional) To provide the `id` of the owner if it is not an
|
|
158
|
-
Organization model. If the owner is an Organization, this prop can be left
|
|
159
|
-
unspecified.
|
|
160
|
-
|
|
161
|
-
### Usage
|
|
162
|
-
|
|
163
|
-
```js
|
|
141
|
+
##### Usage
|
|
142
|
+
```jsx
|
|
164
143
|
import React, { useState } from "react";
|
|
165
144
|
|
|
166
145
|
import { SendMessagePane } from "@bigbinary/neeto-message-templates-frontend";
|
|
@@ -207,54 +186,5 @@ const App = () => {
|
|
|
207
186
|
};
|
|
208
187
|
```
|
|
209
188
|
|
|
210
|
-
#
|
|
211
|
-
|
|
212
|
-
### Engine
|
|
213
|
-
|
|
214
|
-
1. Add this line to your application's Gemfile (replace the path to the local
|
|
215
|
-
copy of neeto-message-templates-engine):
|
|
216
|
-
|
|
217
|
-
```ruby
|
|
218
|
-
gem 'neeto-message-templates-engine', path: '../neeto-message-templates-engine'
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
2. And then execute:
|
|
222
|
-
|
|
223
|
-
```shell
|
|
224
|
-
bundle install
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
3. Refer [engine installation](#engine-installation) steps 3, 4, 5 and 6.
|
|
228
|
-
|
|
229
|
-
### Frontend Package
|
|
230
|
-
|
|
231
|
-
The usage of `yalc` is explained in this video:
|
|
232
|
-
https://www.youtube.com/watch?v=QBiYGP0Rhe0
|
|
233
|
-
|
|
234
|
-
1. See the changes in the host app by executing the following command \
|
|
235
|
-
<br/> Use this command if releasing package for the first time.
|
|
236
|
-
|
|
237
|
-
```shell
|
|
238
|
-
yarn build && yalc publish
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
Use this command to see changes after the initial publish.
|
|
242
|
-
|
|
243
|
-
```shell
|
|
244
|
-
yarn release
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
# Setup dummy host app
|
|
248
|
-
|
|
249
|
-
Setup
|
|
250
|
-
[Instructions](https://github.com/bigbinary/neeto-engineering/tree/main/Local-Development-Setup).
|
|
251
|
-
|
|
252
|
-
Visit http://spinkart.lvh.me:9014 and login with email `oliver@example.com` and
|
|
253
|
-
password `welcome`.
|
|
254
|
-
|
|
255
|
-
### Additional Instructions
|
|
256
|
-
|
|
257
|
-
- Run `yarn build` to bundle the app.
|
|
258
|
-
|
|
259
|
-
- Note: Run the following command before running rails test
|
|
260
|
-
`RAILS_ENV=test rails db:migrate`
|
|
189
|
+
# Instructions for Publishing
|
|
190
|
+
Consult the [building and releasing packages](https://neeto-engineering.neetokb.com/articles/building-and-releasing-packages) guide for details on how to publish.
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"neetoMessageTemplate": {
|
|
3
3
|
"template": {
|
|
4
4
|
"addEmailTemplate": "Add new email template",
|
|
5
|
-
"addSmsTemplate": "Add new
|
|
5
|
+
"addSmsTemplate": "Add new SMS template",
|
|
6
6
|
"addWhatsappTemplate": "Add new whatsapp template",
|
|
7
7
|
"editEmailTemplate": "Edit email template",
|
|
8
|
-
"editSmsTemplate": "Edit
|
|
8
|
+
"editSmsTemplate": "Edit SMS template",
|
|
9
9
|
"editWhatsappTemplate": "Edit whatsapp template",
|
|
10
10
|
"search": "Search {{what}}",
|
|
11
11
|
"markAsActive": "Mark as active",
|
|
@@ -24,17 +24,17 @@
|
|
|
24
24
|
"title": "Template",
|
|
25
25
|
"active": "Active",
|
|
26
26
|
"templateDeleteConfirmation": "Are you sure want to delete <strong>{{name}}</strong>. This action cannot be undone.",
|
|
27
|
-
"deleteTemplate": "Delete {{label}}",
|
|
28
|
-
"emailTemplates": "Email
|
|
29
|
-
"emailTemplate": "Email
|
|
30
|
-
"smsTemplates": "
|
|
31
|
-
"smsTemplate": "
|
|
27
|
+
"deleteTemplate": "Delete {{label, anyCase}}",
|
|
28
|
+
"emailTemplates": "Email templates",
|
|
29
|
+
"emailTemplate": "Email template",
|
|
30
|
+
"smsTemplates": "SMS templates",
|
|
31
|
+
"smsTemplate": "SMS template",
|
|
32
32
|
"whatsappTemplates": "Whatsapp Templates",
|
|
33
33
|
"whatsappTemplate": "Whatsapp Template",
|
|
34
|
-
"emptyState": "There are no {{type}} to show.",
|
|
34
|
+
"emptyState": "There are no {{type, anyCase}} to show.",
|
|
35
35
|
"sendTestEmail": "Send test email",
|
|
36
|
-
"sendTestSms": "Send test
|
|
37
|
-
"filtersEmptyState": "There are no {{type}} to show for applied filters.",
|
|
36
|
+
"sendTestSms": "Send test SMS",
|
|
37
|
+
"filtersEmptyState": "There are no {{type, anyCase}} to show for applied filters.",
|
|
38
38
|
"preview": "Template Preview",
|
|
39
39
|
"resolveVariable": "Resolve {{type}} variables",
|
|
40
40
|
"validation": {
|
|
@@ -49,12 +49,17 @@
|
|
|
49
49
|
},
|
|
50
50
|
"sendMessage": {
|
|
51
51
|
"email": "Send email",
|
|
52
|
-
"sms": "Send
|
|
52
|
+
"sms": "Send SMS",
|
|
53
53
|
"selectTemplate": "Select a template",
|
|
54
|
-
"testSmsNote": "Note: Variable values will be empty for test
|
|
54
|
+
"testSmsNote": "Note: Variable values will be empty for test SMS."
|
|
55
55
|
},
|
|
56
56
|
"common": {
|
|
57
57
|
"send": "Send"
|
|
58
58
|
}
|
|
59
|
+
},
|
|
60
|
+
"messageType": {
|
|
61
|
+
"sms": "SMS",
|
|
62
|
+
"email": "email",
|
|
63
|
+
"whatsapp": "whatsapp"
|
|
59
64
|
}
|
|
60
65
|
}
|
package/dist/index.cjs.js
CHANGED
|
@@ -172,6 +172,11 @@ var MESSAGE_TEMPLATES = {
|
|
|
172
172
|
editText: i18next.t("neetoMessageTemplate.template.editWhatsappTemplate")
|
|
173
173
|
}
|
|
174
174
|
};
|
|
175
|
+
var MESSAGE_TYPES = {
|
|
176
|
+
sms: i18next.t("messageType.sms"),
|
|
177
|
+
email: i18next.t("messageType.email"),
|
|
178
|
+
whatsapp: i18next.t("messageType.whatsapp")
|
|
179
|
+
};
|
|
175
180
|
var DEFAULT_EDITOR_ROW_COUNT = 15;
|
|
176
181
|
|
|
177
182
|
var MESSAGE_TEMPLATE_INITIAL_STATE = {
|
|
@@ -335,16 +340,11 @@ var RowActions = function RowActions(_ref) {
|
|
|
335
340
|
}, t("neetoMessageTemplate.template.delete"))));
|
|
336
341
|
};
|
|
337
342
|
|
|
338
|
-
var renderSearchProps = function renderSearchProps(label
|
|
343
|
+
var renderSearchProps = function renderSearchProps(label) {
|
|
339
344
|
return {
|
|
340
345
|
placeholder: i18next.t("neetoMessageTemplate.template.search", {
|
|
341
346
|
what: label.toLowerCase()
|
|
342
|
-
})
|
|
343
|
-
onChange: function onChange(_ref) {
|
|
344
|
-
var value = _ref.target.value;
|
|
345
|
-
return setSearchTerm(value);
|
|
346
|
-
},
|
|
347
|
-
value: searchTerm
|
|
347
|
+
})
|
|
348
348
|
};
|
|
349
349
|
};
|
|
350
350
|
var buildTableColumnData = function buildTableColumnData(setManageTemplatePane, ownerId) {
|
|
@@ -865,7 +865,7 @@ var TestMessage = function TestMessage(_ref) {
|
|
|
865
865
|
className: "neeto-ui-flex neeto-ui-items-center left-0 flex gap-x-2"
|
|
866
866
|
}, /*#__PURE__*/React__default["default"].createElement(formik$1.Input, {
|
|
867
867
|
name: isEmailTemplate ? "testEmailAddress" : "testPhoneNumber",
|
|
868
|
-
placeholder: t(isEmailTemplate ? "template.emailAddress" : "template.phoneNumber"),
|
|
868
|
+
placeholder: t(isEmailTemplate ? "neetoMessageTemplate.template.emailAddress" : "neetoMessageTemplate.template.phoneNumber"),
|
|
869
869
|
onKeyDown: handleKeyDown,
|
|
870
870
|
onKeyUp: handleTestValidation
|
|
871
871
|
}), /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
|
|
@@ -1032,32 +1032,30 @@ function _toConsumableArray(arr) {
|
|
|
1032
1032
|
}
|
|
1033
1033
|
|
|
1034
1034
|
var useFilters = function useFilters() {
|
|
1035
|
-
var _useState = React.useState(
|
|
1035
|
+
var _useState = React.useState(DEFAULT_PAGE_PROPERTIES),
|
|
1036
1036
|
_useState2 = _slicedToArray(_useState, 2),
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
var
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
setPageProperties = _useState4[1];
|
|
1037
|
+
pageProperties = _useState2[0],
|
|
1038
|
+
setPageProperties = _useState2[1];
|
|
1039
|
+
var _useQueryParams = reactUtils.useQueryParams(),
|
|
1040
|
+
_useQueryParams$searc = _useQueryParams.search_term,
|
|
1041
|
+
searchTerm = _useQueryParams$searc === void 0 ? "" : _useQueryParams$searc;
|
|
1043
1042
|
var filterColumns = buildTableColumnData().filter(ramda.prop("node"));
|
|
1044
1043
|
var searchKeywordProps = {
|
|
1045
|
-
key: "
|
|
1044
|
+
key: "search_term",
|
|
1046
1045
|
node: "name",
|
|
1047
|
-
value: searchTerm
|
|
1048
|
-
setValue:
|
|
1046
|
+
value: searchTerm,
|
|
1047
|
+
setValue: neetoCist.noop
|
|
1049
1048
|
};
|
|
1050
|
-
var
|
|
1049
|
+
var _useState3 = React.useState(function () {
|
|
1051
1050
|
return neetoFiltersFrontend.buildFiltersFromURL([].concat(_toConsumableArray(filterColumns), [searchKeywordProps]));
|
|
1052
1051
|
}),
|
|
1053
|
-
|
|
1054
|
-
filters =
|
|
1055
|
-
setFilters =
|
|
1052
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
1053
|
+
filters = _useState4[0],
|
|
1054
|
+
setFilters = _useState4[1];
|
|
1056
1055
|
return {
|
|
1057
1056
|
filterColumns: filterColumns,
|
|
1058
1057
|
searchKeywordProps: searchKeywordProps,
|
|
1059
1058
|
searchTerm: searchTerm,
|
|
1060
|
-
setSearchTerm: setSearchTerm,
|
|
1061
1059
|
filters: filters,
|
|
1062
1060
|
setFilters: setFilters,
|
|
1063
1061
|
pageProperties: pageProperties,
|
|
@@ -1117,7 +1115,8 @@ var List = function List(_ref) {
|
|
|
1117
1115
|
label = _ref.label,
|
|
1118
1116
|
addText = _ref.addText,
|
|
1119
1117
|
isFilterApplied = _ref.isFilterApplied,
|
|
1120
|
-
ownerId = _ref.ownerId
|
|
1118
|
+
ownerId = _ref.ownerId,
|
|
1119
|
+
type = _ref.type;
|
|
1121
1120
|
var _useTranslation = reactI18next.useTranslation(),
|
|
1122
1121
|
t = _useTranslation.t;
|
|
1123
1122
|
var _useDeleteTemplate = useDeleteTemplate(ownerId),
|
|
@@ -1129,6 +1128,9 @@ var List = function List(_ref) {
|
|
|
1129
1128
|
isDelete = manageTemplatePane.isDelete;
|
|
1130
1129
|
var pageIndex = pageProperties.index,
|
|
1131
1130
|
pageSize = pageProperties.size;
|
|
1131
|
+
var isSms = type === "sms";
|
|
1132
|
+
var typeLabelSingular = isSms ? labelSingular : labelSingular.toLowerCase();
|
|
1133
|
+
var emptyStateLabel = isSms ? label : label.toLowerCase();
|
|
1132
1134
|
var handleDelete = function handleDelete() {
|
|
1133
1135
|
deleteTemplate(template.id, {
|
|
1134
1136
|
onSettled: function onSettled() {
|
|
@@ -1166,9 +1168,9 @@ var List = function List(_ref) {
|
|
|
1166
1168
|
}
|
|
1167
1169
|
},
|
|
1168
1170
|
title: isFilterApplied ? t("neetoMessageTemplate.template.filtersEmptyState", {
|
|
1169
|
-
type:
|
|
1171
|
+
type: emptyStateLabel
|
|
1170
1172
|
}) : t("neetoMessageTemplate.template.emptyState", {
|
|
1171
|
-
type:
|
|
1173
|
+
type: emptyStateLabel
|
|
1172
1174
|
})
|
|
1173
1175
|
})), /*#__PURE__*/React__default["default"].createElement(neetoui.Alert, {
|
|
1174
1176
|
isOpen: isDelete,
|
|
@@ -1180,7 +1182,7 @@ var List = function List(_ref) {
|
|
|
1180
1182
|
}
|
|
1181
1183
|
}),
|
|
1182
1184
|
title: t("neetoMessageTemplate.template.deleteTemplate", {
|
|
1183
|
-
label:
|
|
1185
|
+
label: typeLabelSingular
|
|
1184
1186
|
}),
|
|
1185
1187
|
onClose: function onClose() {
|
|
1186
1188
|
return setManageTemplatePane(ramda.assoc("isDelete", false));
|
|
@@ -1218,7 +1220,6 @@ var MessageTemplates = function MessageTemplates(_ref) {
|
|
|
1218
1220
|
searchKeywordProps = _useFilters.searchKeywordProps,
|
|
1219
1221
|
filterColumns = _useFilters.filterColumns,
|
|
1220
1222
|
searchTerm = _useFilters.searchTerm,
|
|
1221
|
-
setSearchTerm = _useFilters.setSearchTerm,
|
|
1222
1223
|
filters = _useFilters.filters,
|
|
1223
1224
|
setFilters = _useFilters.setFilters,
|
|
1224
1225
|
pageProperties = _useFilters.pageProperties,
|
|
@@ -1260,7 +1261,7 @@ var MessageTemplates = function MessageTemplates(_ref) {
|
|
|
1260
1261
|
onClick: handleActionClick
|
|
1261
1262
|
}),
|
|
1262
1263
|
breadcrumbs: breadcrumbs,
|
|
1263
|
-
searchProps: renderSearchProps(label
|
|
1264
|
+
searchProps: renderSearchProps(label),
|
|
1264
1265
|
title: label
|
|
1265
1266
|
}), /*#__PURE__*/React__default["default"].createElement(SubHeader__default["default"], {
|
|
1266
1267
|
leftActionBlock: /*#__PURE__*/React__default["default"].createElement(neetoFiltersFrontend.Bar, {
|
|
@@ -1289,7 +1290,8 @@ var MessageTemplates = function MessageTemplates(_ref) {
|
|
|
1289
1290
|
pageProperties: pageProperties,
|
|
1290
1291
|
setManageTemplatePane: setManageTemplatePane,
|
|
1291
1292
|
setPageProperties: setPageProperties,
|
|
1292
|
-
templatesData: templatesData
|
|
1293
|
+
templatesData: templatesData,
|
|
1294
|
+
type: type
|
|
1293
1295
|
}), /*#__PURE__*/React__default["default"].createElement(AddEdit, {
|
|
1294
1296
|
addText: addText,
|
|
1295
1297
|
createUpdateTemplate: createUpdateTemplate,
|
|
@@ -1425,7 +1427,7 @@ var Whatsapp = function Whatsapp(_ref) {
|
|
|
1425
1427
|
t = _useTranslation.t;
|
|
1426
1428
|
var getInitialVariableComponents = function getInitialVariableComponents(variables) {
|
|
1427
1429
|
var initialComponents = {};
|
|
1428
|
-
variables.forEach(function (_ref2) {
|
|
1430
|
+
variables === null || variables === void 0 ? void 0 : variables.forEach(function (_ref2) {
|
|
1429
1431
|
var type = _ref2.type,
|
|
1430
1432
|
count = _ref2.count;
|
|
1431
1433
|
initialComponents[type] = Array(count).fill("");
|
|
@@ -1433,7 +1435,8 @@ var Whatsapp = function Whatsapp(_ref) {
|
|
|
1433
1435
|
return initialComponents;
|
|
1434
1436
|
};
|
|
1435
1437
|
var getTemplateMessage = function getTemplateMessage(components) {
|
|
1436
|
-
|
|
1438
|
+
var _nullSafe;
|
|
1439
|
+
return (_nullSafe = neetoCist.nullSafe(ramda.pluck)("text", components)) === null || _nullSafe === void 0 ? void 0 : _nullSafe.join("\n");
|
|
1437
1440
|
};
|
|
1438
1441
|
if (ramda.isEmpty(templates)) {
|
|
1439
1442
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, null, t("neetoMessageTemplate.template.emptyState", {
|
|
@@ -1574,7 +1577,7 @@ var SendMessagePane = function SendMessagePane(_ref) {
|
|
|
1574
1577
|
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Pane.Header, null, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
1575
1578
|
style: "h2",
|
|
1576
1579
|
weight: "semibold"
|
|
1577
|
-
}, t("neetoMessageTemplate.common.send"), " ", type)), /*#__PURE__*/React__default["default"].createElement(neetoui.Pane.Body, null, isWhatsappTemplate ? /*#__PURE__*/React__default["default"].createElement(Whatsapp, {
|
|
1580
|
+
}, t("neetoMessageTemplate.common.send"), " ", MESSAGE_TYPES[type])), /*#__PURE__*/React__default["default"].createElement(neetoui.Pane.Body, null, isWhatsappTemplate ? /*#__PURE__*/React__default["default"].createElement(Whatsapp, {
|
|
1578
1581
|
handleSubmit: handleSubmit,
|
|
1579
1582
|
onClose: onClose,
|
|
1580
1583
|
templates: templates
|