@capillarytech/creatives-library 7.14.39 → 7.14.41

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.
Files changed (38) hide show
  1. package/i18n.js +4 -6
  2. package/package.json +1 -1
  3. package/reducers.js +2 -0
  4. package/services/api.js +9 -1
  5. package/tests/integration/TemplateCreation/TemplateCreation.integration.test.js +420 -0
  6. package/tests/integration/TemplateCreation/api-response.js +1663 -0
  7. package/tests/integration/TemplateCreation/helper.js +23 -0
  8. package/tests/integration/TemplateCreation/mocks/initialState.js +428 -0
  9. package/tests/integration/TemplateCreation/msw-handler.js +48 -0
  10. package/v2Components/CapActionButton/index.js +1 -0
  11. package/v2Components/FormBuilder/index.js +28 -4
  12. package/v2Containers/Assets/Gallery/index.js +1 -1
  13. package/v2Containers/CreativesContainer/constants.js +2 -0
  14. package/v2Containers/CreativesContainer/selectors.js +2 -2
  15. package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +8 -0
  16. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +3 -0
  17. package/v2Containers/Line/Container/Text/index.js +3 -2
  18. package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +4 -0
  19. package/v2Containers/Line/Container/index.js +1 -1
  20. package/v2Containers/Rcs/index.js +3 -0
  21. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +250 -3
  22. package/v2Containers/Sms/Create/actions.js +9 -0
  23. package/v2Containers/Sms/Create/constants.js +2 -0
  24. package/v2Containers/Sms/Create/index.js +12 -0
  25. package/v2Containers/Sms/Create/sagas.js +19 -3
  26. package/v2Containers/Sms/Create/tests/sagas.test.js +82 -0
  27. package/v2Containers/Templates/index.js +26 -11
  28. package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +96 -80
  29. package/v2Containers/TemplatesV2/index.js +1 -1
  30. package/v2Containers/Viber/index.js +1 -0
  31. package/v2Containers/Whatsapp/constants.js +27 -8
  32. package/v2Containers/Whatsapp/index.js +14 -2
  33. package/v2Containers/Whatsapp/messages.js +21 -4
  34. package/v2Containers/Whatsapp/styles.scss +3 -0
  35. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +180 -128
  36. package/v2Containers/Whatsapp/tests/utils.test.js +1 -1
  37. package/v2Containers/Whatsapp/utils.js +2 -1
  38. package/v2Containers/mockdata.js +5 -5
@@ -0,0 +1,23 @@
1
+ import '@testing-library/jest-dom';
2
+ import 'whatwg-fetch';
3
+ import {
4
+ screen,
5
+ within,
6
+ /* eslint-enable import/named */
7
+ } from '../../../utils/test-utils';
8
+
9
+ /**
10
+ * Helper function
11
+ * @returns creativesScreen
12
+ */
13
+ export async function getCreativesScreen() {
14
+ const creativesScreen = within(
15
+ await screen.findByTestId(
16
+ 'cap-wrapper',
17
+ {},
18
+ { timeout: 5000, interval: 250 },
19
+ ),
20
+ );
21
+ return creativesScreen;
22
+ }
23
+
@@ -0,0 +1,428 @@
1
+ export const mockInitialState = {
2
+ cap: {
3
+ metaEntities: {
4
+ tags: [],
5
+ layouts: [],
6
+ },
7
+ topbarMenuData: {
8
+ status: "success",
9
+ data: [
10
+ {
11
+ label: {
12
+ key: null,
13
+ ref: null,
14
+ props: {
15
+ id: "creatives.containersV2.Cap.campaigns",
16
+ defaultMessage: "Campaigns",
17
+ values: {},
18
+ },
19
+ _owner: null,
20
+ _store: {},
21
+ },
22
+ link: "/campaigns/ui/list",
23
+ key: "campaigns",
24
+ },
25
+ {
26
+ label: {
27
+ key: null,
28
+ ref: null,
29
+ props: {
30
+ id: "creatives.containersV2.audience",
31
+ defaultMessage: "Audience",
32
+ values: {},
33
+ },
34
+ _owner: null,
35
+ _store: {},
36
+ },
37
+ link: "/audience-manager/list",
38
+ key: "audience",
39
+ },
40
+ {
41
+ label: {
42
+ key: null,
43
+ ref: null,
44
+ props: {
45
+ id: "creatives.containersV2.incentive",
46
+ defaultMessage: "Incentive",
47
+ values: {},
48
+ },
49
+ _owner: null,
50
+ _store: {},
51
+ },
52
+ link: "/coupons/ui/",
53
+ key: "incentive",
54
+ },
55
+ {
56
+ label: {
57
+ key: null,
58
+ ref: null,
59
+ props: {
60
+ id: "creatives.containersV2.Cap.creatives",
61
+ defaultMessage: "Creatives",
62
+ values: {},
63
+ },
64
+ _owner: null,
65
+ _store: {},
66
+ },
67
+ link: "/creatives/ui/v2",
68
+ key: "creatives",
69
+ },
70
+ ],
71
+ },
72
+ fetchingSchema: true,
73
+ user: {
74
+ lastName: "Karan fd",
75
+ active: "true",
76
+ loginCount: 10326902,
77
+ authEntities: {
78
+ userRoleType: "org",
79
+ userEntities: {
80
+ store: [],
81
+ },
82
+ },
83
+ passwordValidity: "2023-12-01 12:29:25",
84
+ creationDate: "2013-06-19 11:06:20",
85
+ refID: "15000449",
86
+ lang: "en",
87
+ accessiblePermissions: [
88
+ "OE",
89
+ "SOE",
90
+ "DOT",
91
+ "Analytics",
92
+ "Tech support",
93
+ "AOM",
94
+ "OM",
95
+ "SMS CCMS Dumps",
96
+ "Raw Data Dump",
97
+ "ACCESSTEAM",
98
+ "SOCIAL",
99
+ "GOD",
100
+ "DCS",
101
+ "MC_READ",
102
+ "LP",
103
+ "MC_RESEND_COUPON",
104
+ "ADMIN_ACCESS",
105
+ "PII_MASK",
106
+ "PII_MASK_NOT_REQUIRED",
107
+ "ALL_MSG_APPROVE",
108
+ "COUPON_MSG_APPROVE",
109
+ "POINTS_MSG_APPROVE",
110
+ "LIST_CSV_UPLOAD",
111
+ "EXT_FACT_ACCESS",
112
+ "AUDIENCE_MANAGER_UI_VIEW",
113
+ "CAMPAIGNS_UI_VIEW",
114
+ "INCENTIVES_UI_VIEW",
115
+ "CREATIVES_UI_VIEW",
116
+ "MC_SEARCH",
117
+ "MC_CIR_VIEW",
118
+ "MC_GWR_VIEW",
119
+ "bounceback_campaign_auth",
120
+ "MC_CUSTOMER_UPDATE",
121
+ "MC_CIR_UPDATE",
122
+ "MC_OLD_CHANGE_ID_WRT",
123
+ "MC_OLD_MBL_REALLOC_XCUTE",
124
+ "MC_OLD_MBL_REALLOC_WRT",
125
+ "MC_OLD_ACC_MERGE_XCUTE",
126
+ "MC_OLD_ACC_MERGE_WRT",
127
+ "CAMP_CONF_ALL",
128
+ "CAMP_CREATE",
129
+ "CAMP_MSG_CREATE",
130
+ "CAMP_MSG_APPROVE",
131
+ "CAMP_COUPON_CREATE",
132
+ "CAMP_REPORT_VIEW",
133
+ "CAMP_LIST_CONF",
134
+ "CAMP_MSG_TEMPLATE_DESIGN",
135
+ "configure_actions",
136
+ "view_coupon_series",
137
+ "view_rule_campaign",
138
+ "configure_coupon_series",
139
+ "MC_GWR_UPDATE",
140
+ "MC_SETTINGS",
141
+ "MC_OLD_GOODWILL_XCUTE",
142
+ "MC_OLD_GOODWILL_WRT",
143
+ "command_center_admin",
144
+ "MC_GOODWILL_READ",
145
+ "MC_WRITE",
146
+ "MC_OLD_CHANGE_ID_XCUTE",
147
+ "finance",
148
+ "CAMP_XENGAGE_SETTINGS",
149
+ ],
150
+ orgName: "Capillary Technologies",
151
+ userRoles: {
152
+ ORG: [
153
+ {
154
+ entityType: "ORG",
155
+ entityName: "Capillary Technologies",
156
+ role: "SUPERUSER",
157
+ entityId: 0,
158
+ childEntities: [],
159
+ },
160
+ ],
161
+ },
162
+ isCapUser: true,
163
+ loginName: "ashish",
164
+ proxyOrgList: [],
165
+ attributes: {
166
+ USERNAME: {
167
+ value: "ashish",
168
+ verified: "true",
169
+ },
170
+ MOBILE: {
171
+ value: "919957676767",
172
+ verified: "true",
173
+ },
174
+ EMAIL: {
175
+ value: "cap@coin.com",
176
+ verified: "true",
177
+ },
178
+ },
179
+ aryaUserRoles: {
180
+ ORG: [
181
+ {
182
+ entityType: "ORG",
183
+ entityName: "Capillary Technologies",
184
+ role: "SUPERUSER",
185
+ entityId: 0,
186
+ childEntities: [],
187
+ },
188
+ ],
189
+ },
190
+ accessRoles: {
191
+ "ADA Level Three": 2139,
192
+ "rbacRequestor": 1317,
193
+ "CAMPMOD": 1736,
194
+ "ACCESSTEAM": 1010,
195
+ "MC RESEND COUPON": 1340,
196
+ "Delivery Manager": 1998,
197
+ "all_access": -1,
198
+ "QATest": 1580,
199
+ "Campaigns View": 3736,
200
+ "couponCacheGroup": 1355,
201
+ "AOM Level": 1803,
202
+ "Smith": 1045,
203
+ "access": 1057,
204
+ "LP": 1286,
205
+ "CommandCenterAdmins": 1688,
206
+ "Tech support": 1005,
207
+ "AOMLevel": 1887,
208
+ "minimalAccess": 1264,
209
+ "LM COUPON": 1284,
210
+ "SUPERUSER": 1012,
211
+ "MC SETTING": 3708,
212
+ "CCMS Only": 414,
213
+ "Analytics": 1004,
214
+ "BISEGMENTS": 1525,
215
+ "rajshekar": 1572,
216
+ "ADA Level One": 2137,
217
+ "BIADMIN": 1455,
218
+ "rbacSuper": 1318,
219
+ "DOT": 1003,
220
+ "SOE": 1002,
221
+ "Carsndolls_admin": 347,
222
+ "MCWRITE": 1099,
223
+ "MCNew": 1126,
224
+ "couponAccess": 1262,
225
+ "capillary_technologi": 1051,
226
+ "CreateMessage": 3739,
227
+ "MCREAD": 1098,
228
+ "Guest Access": 387,
229
+ "NAY TEST": 1275,
230
+ "SMS CCMS Dumps": 1008,
231
+ "DEFAULT_PERMISSION": 1393,
232
+ "SOCIAL": 1011,
233
+ "ADA Level Two": 2138,
234
+ "MC View": 1324,
235
+ "QA": 1059,
236
+ "MCWR": 1885,
237
+ "BIUSER": 1461,
238
+ "Raw Data Dump": 1009,
239
+ "MC Search": 1326,
240
+ "ANCYPerm": 1013,
241
+ "MCREADWRITE": 1325,
242
+ "SEQ ASSOC": 1287,
243
+ "Woodland_CCMS-Report": 318,
244
+ "OE": 1001,
245
+ "senior_ops_exe": 313,
246
+ "EXTERNALFACT": 1582,
247
+ "CheckGroup": 1159,
248
+ "SEQ MGR": 1292,
249
+ "rbacApprover": 1316,
250
+ "xyz": 1046,
251
+ "Command Center Admin": 1345,
252
+ "randomjazz": 1144,
253
+ "GLAOM": 1620,
254
+ "AllAccessPerr": 1322,
255
+ "finance": 1350,
256
+ "MCGOODWILLREAD": 1100,
257
+ "testGp": 1328,
258
+ "BIEXPORT": 1527,
259
+ "ONLYCAMPAIGN": 1323,
260
+ "XENGAGESETTINGS": 3715,
261
+ "BIPOC": 1500,
262
+ "BUSSUSRNOCAMPAUT": 2394,
263
+ "LM Setup Group": 1285,
264
+ "EMF": 1085,
265
+ "OM": 1007,
266
+ "RMSETTINGS": 1356,
267
+ "AOM": 1006,
268
+ "BulitUp": 1387,
269
+ "LM BUSINESS": 1283,
270
+ },
271
+ accessibleOUList: {
272
+ ExpressWay: 50007995,
273
+ Franchisee: 50007996,
274
+ supermarket: 50007994,
275
+ All: -1,
276
+ },
277
+ type: "ADMIN_USER",
278
+ adminUser: true,
279
+ id: "14783",
280
+ firstName: "Ashish",
281
+ orgID: 0,
282
+ },
283
+ messages: [],
284
+ fetching_userdata: false,
285
+ isLoggedIn: true,
286
+ currentOrgDetails: {
287
+ basic_details: {
288
+ fiscal_year_start: "-1",
289
+ base_country_code: "IN",
290
+ max_sms_hour: 23,
291
+ base_currency_iso: {
292
+ label: "INR",
293
+ symbol: "₹",
294
+ },
295
+ base_language: "en",
296
+ value_sms_credits: "",
297
+ bulk_sms_credits: "",
298
+ base_country: "India",
299
+ supported_languages: [
300
+ {
301
+ lang_id: 69,
302
+ language: "English",
303
+ iso_code: "en",
304
+ },
305
+ ],
306
+ base_currency_name: "Indian Rupee ",
307
+ name: "Reon_Data",
308
+ base_language_iso: {
309
+ lang: "",
310
+ locale: "",
311
+ },
312
+ base_timezone_iso: {
313
+ label: "Asia/Kolkata",
314
+ offset: "+05:30",
315
+ },
316
+ phone: "",
317
+ base_country_iso: {
318
+ code: "IN",
319
+ name: "India",
320
+ },
321
+ address: "0mk",
322
+ org_id: "50146",
323
+ min_sms_hour: 0,
324
+ base_currency_symbol: "₹",
325
+ language: "",
326
+ timezone_offset: "+05:30",
327
+ timezone: "Asia/Kolkata",
328
+ is_active: 1,
329
+ base_lang_locale: "",
330
+ base_currency: "INR",
331
+ },
332
+ sender_details: {
333
+ GSM: "9876987022",
334
+ CDMA: "9876987022",
335
+ label: "TATADG",
336
+ replyToEmail: "tata@dg.com",
337
+ senderEmail: "tata@dg.com",
338
+ },
339
+ accessibleFeatures: [
340
+ "PERSONALISATION_STRATEGY",
341
+ "CHANNEL_PRIORITY_STRATEGY",
342
+ "STORE2DOOR_PLUS_ENABLED",
343
+ "XENGAGE_STRATEGY",
344
+ "COMMUNICATION_LIMIT",
345
+ "CAMPAIGNS_FTP",
346
+ "PROMO_ENGINE",
347
+ "LOYALTY_NEW_UI_ENABLED",
348
+ "EXTERNALLY_MANAGED_COUPONS",
349
+ "FLEET_LOYALTY_ENABLED",
350
+ "JOURNEY_UI",
351
+ "GIFT_CARDS",
352
+ "LOYALTY_PROMOTION_ENABLED",
353
+ "LABEL_CUSTOMISATION_ENABLED",
354
+ "ENABLE_NOTIFICATION_CENTRE",
355
+ "ENABLE_OU_BASED_RBAC",
356
+ ],
357
+ org_loyalty_v2_status: true,
358
+ module_details: [
359
+ {
360
+ code: "intouchHomePage",
361
+ display_order: 1,
362
+ id: -1,
363
+ name: "HOME",
364
+ namespace: "intouchHomePage",
365
+ url: "/home/ui",
366
+ version: "1.0.0",
367
+ },
368
+ {
369
+ id: 44,
370
+ name: "ENGAGE+",
371
+ code: "campaigns/ui/list",
372
+ version: "1.0.0.1",
373
+ namespace: "campaign",
374
+ display_order: 9,
375
+ url: "/campaigns/ui/list",
376
+ },
377
+ {
378
+ id: 45,
379
+ name: "LOYALTY+",
380
+ code: "loyalty/ui/",
381
+ version: "1.0.0.1",
382
+ namespace: "loyalty/ui/",
383
+ display_order: 6,
384
+ url: "/loyalty/ui/",
385
+ },
386
+ {
387
+ id: 39,
388
+ name: "MEMBER CARE",
389
+ code: "memberCare",
390
+ version: "1.0.0.1",
391
+ namespace: "memberCare",
392
+ display_order: 5,
393
+ url: "/memberCare/index",
394
+ },
395
+ {
396
+ id: 27,
397
+ name: "MASTERS",
398
+ code: "org",
399
+ version: "1.0.0.1",
400
+ namespace: "org",
401
+ display_order: 0,
402
+ url: "/org/index",
403
+ },
404
+ {
405
+ id: 26,
406
+ name: "WORKBENCH",
407
+ code: "businessProcesses",
408
+ version: "1.0.0.1",
409
+ namespace: "businessProcesses",
410
+ display_order: 10,
411
+ url: "/businessProcesses/index",
412
+ },
413
+ ],
414
+ org_campaign_v2_status: true,
415
+ orgNamespaceInfo: {
416
+ orgNamespaceEnabled: "1",
417
+ namespace: {
418
+ id: 10,
419
+ name: "US-Standard",
420
+ parent_namespace_id: -1,
421
+ scope: "ORG",
422
+ is_active: 1,
423
+ },
424
+ },
425
+ },
426
+ token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6WyIxNDc4MyJdLCJvcmdJRCI6MCwiZXhwIjoxNjgyNDkyNTAzLCJpYXQiOjE2ODI0MDYxMDcsImlzcyI6ImNhcGlsbGFyeXRlY2guY29tIiwiYXVkIjoiY2FwaWxsYXJ5LGludG91Y2gsYXJ5YSxyZW9uLGFwcHMiLCJzb3VyY2UiOiJXRUJBUFAifQ.2fut2NUwkwamuUJ33hqpQP24BJDzf531crAfCJ1ivmc",
427
+ orgID: 50146,
428
+ }};
@@ -0,0 +1,48 @@
1
+ import { rest } from 'msw';
2
+ import { setupServer } from 'msw/node';
3
+ import 'whatwg-fetch';
4
+ import * as apiResponse from './api-response';
5
+
6
+ import config from '../../../config/app';
7
+ const API_ENDPOINT = config.development.api_endpoint;
8
+ const AUTH_ENDPOINT = config.development.auth_endpoint;
9
+
10
+ export const server = setupServer(
11
+ rest.options('*', (req, res, ctx) =>
12
+ res(
13
+ ctx.status(200),
14
+ ctx.set('access-control-allow-origin', '*'),
15
+ ctx.set('Access-Control-Allow-Headers', 'x-cap-org'),
16
+ ctx.set('Access-Control-Allow-Headers', 'x-cap-remote-user'),
17
+ ctx.set('Access-Control-Allow-Headers', 'x-cap-api-data-context-org-id'),
18
+ ctx.set('Access-Control-Allow-Headers', 'x-cap-api-auth-org-id'),
19
+ ),
20
+ ),
21
+ rest.get(`${AUTH_ENDPOINT}/auth/org/:orgId/users`, (req, res, ctx) => {
22
+ const { orgId } = req.params;
23
+ switch (orgId) {
24
+ case '50146':
25
+ return res(ctx.status(200), ctx.json(apiResponse.authOrgUsersReonData));
26
+ }
27
+ }),
28
+
29
+ rest.get(`${AUTH_ENDPOINT}/auth/user`, (req, res, ctx) =>
30
+ res(ctx.status(200), ctx.json(apiResponse.authUserReonData)),
31
+ ),
32
+
33
+ rest.get(`${AUTH_ENDPOINT}/auth/org/users`, (req, res, ctx) =>
34
+ res(ctx.status(200), ctx.json(apiResponse.authOrgUsersReonData)),
35
+ ),
36
+ rest.get(`${API_ENDPOINT}/templates/Sms`, (req, res, ctx) =>
37
+ res(ctx.status(200), ctx.json(apiResponse.smsTemplates)),
38
+ ),
39
+ rest.get(`${API_ENDPOINT}/templates/Rcs`, (req, res, ctx) =>
40
+ res(ctx.status(200), ctx.json(apiResponse.rcsTemplates)),
41
+ ),
42
+ rest.get(`${API_ENDPOINT}/meta/wecrm`, (req, res, ctx) =>
43
+ res(ctx.status(200), ctx.json(apiResponse.viberAccount)),
44
+ ),
45
+ rest.get(`${API_ENDPOINT}/assets/image`, (req, res, ctx) =>
46
+ res(ctx.status(200), ctx.json(apiResponse.gallery)),
47
+ ),
48
+ );
@@ -89,6 +89,7 @@ export const CapActionButton = (props) => {
89
89
  id="rcs-template-Button-link"
90
90
  onChange={onButtonLinkChange}
91
91
  placeholder={formatMessage(messages.templateButtonLinkPlaceholder)}
92
+ data-testid="cta_btn_link"
92
93
  value={buttonLink}
93
94
  size="default"
94
95
  errorMessage={buttonURLErrorMessage}
@@ -11,9 +11,11 @@ import PropTypes from 'prop-types';
11
11
  import React from 'react';
12
12
  import _ from 'lodash';
13
13
  import { Tabs, Table, Modal} from 'antd';
14
- import { CapSpin, CapDrawer, CapButton, CapInput, CapPopover, CapImage, CapCheckbox, CapRadio, CapSelect, CapTable, CapRow, CapColumn, CapNotification, CapUploader, CapHeading, CapIcon, CapTooltip} from '@capillarytech/cap-ui-library';
14
+ import { connect } from 'react-redux';
15
+ import { CapSpin, CapDrawer, CapButton, CapInput, CapPopover, CapImage, CapCheckbox, CapRadio, CapSelect, CapTable, CapRow, CapColumn, CapNotification, CapUploader, CapHeading, CapIcon, CapTooltip, CapAiSuggestions} from '@capillarytech/cap-ui-library';
15
16
  import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
16
17
  import LabelHOC from '@capillarytech/cap-ui-library/assets/HOCs/ComponentWithLabelHOC';
18
+ import { createStructuredSelector } from 'reselect';
17
19
  import { CAP_SPACE_12, CAP_SPACE_08, FONT_COLOR_05, FONT_COLOR_04 } from '@capillarytech/cap-ui-library/styled/variables';
18
20
  import TemplatePreview from '../TemplatePreview';
19
21
  import TagList from '../../v2Containers/TagList';
@@ -24,9 +26,10 @@ import EDMEditor from "../Edmeditor";
24
26
  import BeeEditor from '../../v2Containers/BeeEditor';
25
27
  import CustomPopOver from '../CustomPopOver';
26
28
  import messages from './messages';
29
+ import { selectCurrentOrgDetails } from "../../v2Containers/Cap/selectors";
27
30
  import './_formBuilder.scss';
28
31
  import {updateCharCount, checkUnicode} from "../../utils/smsCharCountV2";
29
- import { SMS, LINE } from '../../v2Containers/CreativesContainer/constants';
32
+ import { SMS, LINE, ENABLE_AI_SUGGESTIONS } from '../../v2Containers/CreativesContainer/constants';
30
33
  import { validateIfTagClosed } from '../../utils/tagValidations';
31
34
  import globalMessages from '../../v2Containers/Cap/messages';
32
35
  import { convert } from 'html-to-text';
@@ -2278,6 +2281,12 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
2278
2281
  const messageContent = isVersionEnable ? formData[`${currentTab - 1}`][val.id] : formData[val.id];
2279
2282
  const { MISSING_TAG_ERROR, UNSUPPORTED_TAG_ERROR, TAG_BRACKET_COUNT_MISMATCH_ERROR } = errorMessageForTags;
2280
2283
  const { formatMessage } = this.props.intl;
2284
+
2285
+ const { accessibleFeatures = [] } = this.props.currentOrgDetails || {};
2286
+ const hasAiSuggestionsEnabled = accessibleFeatures.includes(
2287
+ ENABLE_AI_SUGGESTIONS
2288
+ );
2289
+
2281
2290
  let errorMessageText = false;
2282
2291
  switch (errorType) {
2283
2292
  case MISSING_TAG_ERROR:
@@ -2313,6 +2322,16 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
2313
2322
  disabled={val.disabled}
2314
2323
  cols={cols}
2315
2324
  />
2325
+ {this.props.schema.channel === "SMS" && this.props.fetchAiSuggestions && hasAiSuggestionsEnabled && (
2326
+ <CapAiSuggestions
2327
+ style={{ bottom: "1rem" }}
2328
+ text={messageContent || ""}
2329
+ setText={(x) => {
2330
+ this.updateFormData(x, val);
2331
+ }}
2332
+ getCompletions={this.props.fetchAiSuggestions}
2333
+ />
2334
+ )}
2316
2335
  </CapColumn>
2317
2336
  );
2318
2337
  }
@@ -3617,7 +3636,12 @@ FormBuilder.propTypes = {
3617
3636
  setDrawerVisibility: PropTypes.bool,
3618
3637
  capDrawerContent: PropTypes.array,
3619
3638
  isFullMode: PropTypes.bool,
3620
-
3639
+ fetchAiSuggestions: PropTypes.func,
3640
+ currentOrgDetails: PropTypes.object,
3621
3641
  };
3622
3642
 
3623
- export default injectIntl(FormBuilder);
3643
+ const mapStateToProps = createStructuredSelector({
3644
+ currentOrgDetails: selectCurrentOrgDetails(),
3645
+ });
3646
+
3647
+ export default connect(mapStateToProps)(injectIntl(FormBuilder));
@@ -306,7 +306,7 @@ export class Gallery extends React.Component { // eslint-disable-line react/pref
306
306
  getTemplateDataForGrid = ({templates, handlers, filterContent, isLoading, loadingTip}) => {
307
307
  const currentChannel = 'gallery';
308
308
  const { searchLoader, searchText } = this.state;
309
- const cardDataList = templates.length ? _.map(templates, (template) => {
309
+ const cardDataList = templates?.length ? _.map(templates, (template) => {
310
310
  const templateData =
311
311
  {
312
312
  key: `${currentChannel}-card-${template.name}`,
@@ -23,3 +23,5 @@ export const SHOW_CONTANER_LOADER = "app/CreativesContainer/SHOW_CONTANER_LOADER
23
23
  export const HIDE_CONTAINER_LOADER = "app/CreativesContainer/HIDE_CONTAINER_LOADER";
24
24
 
25
25
  export const WHATSAPP_HELP_DOC_LINK = "https://docs.capillarytech.com/docs/create-whatsapp-template";
26
+
27
+ export const ENABLE_AI_SUGGESTIONS = "ENABLE_AI_SUGGESTIONS";
@@ -16,11 +16,11 @@ const selectCreativesContainerDomain = () => (state) => state.get('creativesCont
16
16
 
17
17
  const makeSelectCreativesContainer = () => createSelector(
18
18
  selectCreativesContainerDomain(),
19
- (substate) => substate.toJS()
19
+ (substate) => substate?.toJS()
20
20
  );
21
21
  const isLoading = () => createSelector(
22
22
  makeSelectCreativesContainer(),
23
- (substate) => substate.containerLoader
23
+ (substate) => substate?.containerLoader
24
24
  );
25
25
 
26
26
  export default makeSelectCreativesContainer;
@@ -5,7 +5,9 @@ exports[`Test SlideBoxContent container campaign message, add creative click rcs
5
5
  className="add-creatives-section creatives-library-mode "
6
6
  >
7
7
  <CapSlideBox
8
+ closeIconPosition="right"
8
9
  closeIconSize="m"
10
+ closeIconType="close"
9
11
  content={
10
12
  <SlideBoxContent
11
13
  currentChannel="RCS"
@@ -76,7 +78,9 @@ exports[`Test SlideBoxContent container campaign message, add creative click wha
76
78
  className="add-creatives-section creatives-library-mode "
77
79
  >
78
80
  <CapSlideBox
81
+ closeIconPosition="right"
79
82
  closeIconSize="m"
83
+ closeIconType="close"
80
84
  content={
81
85
  <SlideBoxContent
82
86
  currentChannel="WHATSAPP"
@@ -147,7 +151,9 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit all data
147
151
  className="add-creatives-section creatives-library-mode "
148
152
  >
149
153
  <CapSlideBox
154
+ closeIconPosition="right"
150
155
  closeIconSize="m"
156
+ closeIconType="close"
151
157
  content={
152
158
  <SlideBoxContent
153
159
  currentChannel="WHATSAPP"
@@ -220,7 +226,9 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit min data
220
226
  className="add-creatives-section creatives-library-mode "
221
227
  >
222
228
  <CapSlideBox
229
+ closeIconPosition="right"
223
230
  closeIconSize="m"
231
+ closeIconType="close"
224
232
  content={
225
233
  <SlideBoxContent
226
234
  currentChannel="WHATSAPP"
@@ -2806,6 +2806,7 @@ new message content.",
2806
2806
  className="ComponentWithLabelHOC__ComponentWithLabelWrapper-sc-1qk6bpg-1 evSAae"
2807
2807
  >
2808
2808
  <CapSelect
2809
+ getMenuOptionsProps={[Function]}
2809
2810
  onChange={[Function]}
2810
2811
  options={
2811
2812
  Array [
@@ -6330,6 +6331,7 @@ new message content.",
6330
6331
  className="ComponentWithLabelHOC__ComponentWithLabelWrapper-sc-1qk6bpg-1 evSAae"
6331
6332
  >
6332
6333
  <CapSelect
6334
+ getMenuOptionsProps={[Function]}
6333
6335
  onChange={[Function]}
6334
6336
  options={
6335
6337
  Array [
@@ -9838,6 +9840,7 @@ new message content.",
9838
9840
  className="ComponentWithLabelHOC__ComponentWithLabelWrapper-sc-1qk6bpg-1 evSAae"
9839
9841
  >
9840
9842
  <CapSelect
9843
+ getMenuOptionsProps={[Function]}
9841
9844
  onChange={[Function]}
9842
9845
  options={
9843
9846
  Array [
@@ -126,8 +126,8 @@ export const LineText = ({
126
126
  location,
127
127
  tagModule: 'outbound',
128
128
  }) || {};
129
- if (value === '') {
130
- errorMessage = formatMessage(messages.emptyTitleErrorMessage);
129
+ if (value.trim() === '') {
130
+ errorMessage = formatMessage(messages.emptyContentErrorMessage);
131
131
  } else if (value.length > charLimit) {
132
132
  errorMessage = formatMessage(messages.limitExceededContentErrorMessage);
133
133
  } else if (isBraceError) {
@@ -337,6 +337,7 @@ export const LineText = ({
337
337
  value={messageTitle || ''}
338
338
  size="default"
339
339
  label={formatMessage(messages.textMessageTitleLabel)}
340
+ data-testid="template_name"
340
341
  />
341
342
  )
342
343
  : null