@capillarytech/creatives-library 7.15.4 → 7.15.6

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.
@@ -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}
@@ -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}`,
@@ -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;
@@ -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
@@ -22151,6 +22151,7 @@ new message content.",
22151
22151
  >
22152
22152
  <_class
22153
22153
  className="text-template-title"
22154
+ data-testid="template_name"
22154
22155
  defaultValue=""
22155
22156
  errorMessage={false}
22156
22157
  id="undefined_input"
@@ -22195,6 +22196,7 @@ new message content.",
22195
22196
  </CapHeading>
22196
22197
  </ComponentWithLabelHOC__StyledCapHeading>
22197
22198
  <CapInput
22199
+ data-testid="template_name"
22198
22200
  defaultValue=""
22199
22201
  errorMessage={false}
22200
22202
  id="undefined_input"
@@ -22205,6 +22207,7 @@ new message content.",
22205
22207
  value=""
22206
22208
  >
22207
22209
  <Input
22210
+ data-testid="template_name"
22208
22211
  defaultValue=""
22209
22212
  id="undefined_input"
22210
22213
  onChange={[Function]}
@@ -22221,6 +22224,7 @@ new message content.",
22221
22224
  >
22222
22225
  <input
22223
22226
  className="ant-input"
22227
+ data-testid="template_name"
22224
22228
  id="undefined_input"
22225
22229
  onChange={[Function]}
22226
22230
  onKeyDown={[Function]}
@@ -150,7 +150,7 @@ export const LineContainer = ({
150
150
  };
151
151
  updateLineWrapperContent([lineContent]);
152
152
  }
153
- }, [Line.templateDetails]);
153
+ }, [Line?.templateDetails]);
154
154
 
155
155
  useEffect(() => {
156
156
  if (templateData && templateData.versions) {
@@ -486,6 +486,7 @@ export const Rcs = (props) => {
486
486
  value={templateTitle || ''}
487
487
  size="default"
488
488
  maxLength={TEMPLATE_TITLE_MAX_LENGTH}
489
+ data-testid="template_title"
489
490
  suffix={
490
491
  <CapLabel type="label1">{`${templateTitle?.length} / ${TEMPLATE_TITLE_MAX_LENGTH}`}</CapLabel>
491
492
  }
@@ -526,6 +527,7 @@ export const Rcs = (props) => {
526
527
  errorMessage={templateDescError}
527
528
  value={templateDesc || ''}
528
529
  maxLength={1000}
530
+ data-testid="rcs_text_area"
529
531
  />
530
532
  {renderLabel('templateButton', true, 'templateButtonDesc')}
531
533
  <CapCheckboxGroup
@@ -1061,6 +1063,7 @@ export const Rcs = (props) => {
1061
1063
  {isFullMode && (
1062
1064
  <CapInput
1063
1065
  id="rcs_template_name_input"
1066
+ data-testid="template_name"
1064
1067
  onChange={onTemplateNameChange}
1065
1068
  errorMessage={templateNameError}
1066
1069
  placeholder={formatMessage(