@capillarytech/creatives-library 9.0.55-alpha.1 → 9.0.55

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 (42) hide show
  1. package/.vscode/settings.json +3 -0
  2. package/constants/unified.js +1 -0
  3. package/package.json +1 -1
  4. package/services/api.js +0 -20
  5. package/styles/containers/layout/_layoutPage.scss +2 -1
  6. package/translations/en.json +2 -2
  7. package/utils/common.js +4 -0
  8. package/v2Components/AccessForbidden/_accessForbidden.scss +22 -12
  9. package/v2Components/AccessForbidden/index.js +27 -8
  10. package/v2Components/AccessForbidden/messages.js +2 -3
  11. package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +0 -20
  12. package/v2Components/CommonTestAndPreview/constants.js +0 -2
  13. package/v2Components/CommonTestAndPreview/index.js +4 -1
  14. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +0 -106
  15. package/v2Components/CommonTestAndPreview/tests/constants.test.js +1 -9
  16. package/v2Components/NavigationBar/mfeModuleHeader.config.js +1 -1
  17. package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +2 -2
  18. package/v2Containers/CommunicationFlow/CommunicationFlow.js +56 -118
  19. package/v2Containers/CommunicationFlow/CommunicationFlow.scss +1 -1
  20. package/v2Containers/CommunicationFlow/CommunicationFlowCard.js +6 -22
  21. package/v2Containers/CommunicationFlow/Tests/CommunicationFlow.test.js +49 -421
  22. package/v2Containers/CommunicationFlow/Tests/CommunicationFlowCard.test.js +2 -18
  23. package/v2Containers/CommunicationFlow/constants.js +1 -90
  24. package/v2Containers/CommunicationFlow/index.js +20 -15
  25. package/v2Containers/CommunicationFlow/messages.js +0 -4
  26. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/SenderDetails.js +0 -6
  27. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/SenderDetails.test.js +0 -25
  28. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/deliverySettingsConfig.test.js +4 -11
  29. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/deliverySettingsConfig.js +5 -24
  30. package/v2Containers/CreativesContainer/index.js +7 -1
  31. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +6 -6
  32. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +4 -4
  33. package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +32 -32
  34. package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +36 -36
  35. package/v2Containers/Rcs/constants.js +1 -0
  36. package/v2Containers/Rcs/index.js +10 -1
  37. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +226 -118
  38. package/v2Containers/Rcs/tests/index.test.js +121 -0
  39. package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +8 -8
  40. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +30 -30
  41. package/v2Containers/Templates/index.js +26 -0
  42. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +268 -268
@@ -0,0 +1,3 @@
1
+ {
2
+ "eslint.enable": false
3
+ }
@@ -63,6 +63,7 @@ export const ENABLE_AI_SUGGESTIONS = 'ENABLE_AI_SUGGESTIONS';
63
63
  export const AI_CONTENT_BOT_DISABLED = 'AI_CONTENT_BOT_DISABLED';
64
64
  export const AI_DOCUMENTATION_BOT_ENABLED = 'AI_DOCUMENTATION_BOT_ENABLED';
65
65
  export const ENABLE_PRODUCT_SUPPORT_VIDEOS = 'ENABLE_PRODUCT_SUPPORT_VIDEOS';
66
+ export const SUPPORT_ENGAGEMENT_MODULE = 'SUPPORT_ENGAGEMENT_MODULE';
66
67
  export const EMBEDDED = 'embedded';
67
68
  // --- Tag/Validation Constants ---
68
69
  export const CARD_RELATED_TAGS = [
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "9.0.55-alpha.1",
4
+ "version": "9.0.55",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
package/services/api.js CHANGED
@@ -701,26 +701,6 @@ export const createCentralCommsMetaId = (payload, metaType = TRANSACTION) => {
701
701
  return request(url, getAPICallObject('POST', payload, false, false, false, true));
702
702
  };
703
703
 
704
- // CCS CommDefinition API (new Veyron /api/v1/commdefinition surface, proxied
705
- // through cap-creatives-api's /comm-definitions). Used by CommunicationFlow's
706
- // own Save action — separate from the legacy messageMeta functions above,
707
- // which remain in use by CreativesContainer's own save flow (Cap/sagas.js).
708
- export const createCommDefinition = (payload) => {
709
- const url = `${API_ENDPOINT}/comm-definitions`;
710
- return request(url, getAPICallObject('POST', payload, false, false, false, true));
711
- };
712
-
713
- // Opens a new DRAFT version with the given content on an EXISTING
714
- // CommDefinition (same id/referenceId) — used by CommunicationFlow's edit-mode
715
- // save (re-editing a rejected alert) instead of createCommDefinition, so the
716
- // alert keeps its identity rather than becoming a brand-new CommDefinition.
717
- // Route verified against a real Postman sample against Veyron's own
718
- // /commdefinition/{id}/edit endpoint.
719
- export const editCommDefinition = (commDefinitionId, payload) => {
720
- const url = `${API_ENDPOINT}/comm-definitions/${commDefinitionId}/edit`;
721
- return request(url, getAPICallObject('POST', payload, false, false, false, true));
722
- };
723
-
724
704
  export const getCentralCommsMetaIds = (metaIds, metaType = TRANSACTION) => {
725
705
  const url = `${API_ENDPOINT}/common/central-comms/meta-id/${metaType}?metaIds=${metaIds}`;
726
706
  return request(url, getAPICallObject('GET', null, false, false, false, true));
@@ -77,7 +77,8 @@
77
77
  -webkit-flex: 1 1 auto;
78
78
  -ms-flex: 1 1 auto;
79
79
  flex: 1;
80
- height: calc(100vh - 50px);
80
+ // No height: flex stretch inside `.main` sizes this. A hardcoded
81
+ // calc(100vh - 50px) under-counted the chrome and overhung it by ~83px.
81
82
  overflow: auto;
82
83
  color: #333333;
83
84
  }
@@ -63,8 +63,8 @@
63
63
  "app.v2containers.SmsTrai.Edit.traiEditTitle": "Message",
64
64
  "app.v2containers.SmsTrai.Edit.unicodeLabel": "Allow unicode characters",
65
65
  "app.v2containers.SmsTrai.Edit.unsupportedTagsValidationError": "Unsupported tags: {unsupportedTags}. Please remove them from this message.",
66
- "creatives.components.AccessForbidden.forbiddenDesc": "Please contact your organisation administrator to request access.",
67
- "creatives.components.AccessForbidden.forbiddenHeader": "You don't have permission to view this page.",
66
+ "creatives.components.AccessForbidden.forbiddenDesc": "This page access has not been provided to you.",
67
+ "creatives.components.AccessForbidden.forbiddenHeader": "Access Denied",
68
68
  "creatives.components.BreadCrumbs.header": "This is the BreadCrumbs component !",
69
69
  "creatives.components.CapTagList.Cancel": "Cancel",
70
70
  "creatives.components.CapTagList.Ok": "Ok",
package/utils/common.js CHANGED
@@ -99,6 +99,10 @@ export const hasSupportCKEditor = Auth.hasFeatureAccess.bind(
99
99
  null,
100
100
  SUPPORT_CK_EDITOR,
101
101
  );
102
+ export const hasSupportEngagementModule = Auth.hasFeatureAccess.bind(
103
+ null,
104
+ SUPPORT_ENGAGEMENT_MODULE,
105
+ );
102
106
 
103
107
  export const hasGiftVoucherFeature = Auth.hasFeatureAccess.bind(
104
108
  null,
@@ -1,14 +1,24 @@
1
- // Access-denied screen: rbac-lock icon + heading + subtext (matches the shared
2
- // "no access" screen used across Loyalty+ / Org Settings).
3
- .no-access-icon {
4
- font-size: 48px;
5
- color: #8c8c8c;
6
- }
7
- .no-access-title {
1
+ @import '~@capillarytech/cap-ui-library/styles/_variables';
2
+
3
+ .access-denied {
4
+ width: 100%;
5
+ // This module's ComponentWrapper has no padding, unlike the other MFEs'.
8
6
  margin-top: 16px;
9
- }
10
- .no-access-text {
11
- margin-top: 8px;
12
- color: #6b778c;
13
- max-width: 420px;
7
+ padding-top: $CAP_SPACE_80;
8
+ text-align: center;
9
+
10
+ .access-denied-illustration {
11
+ width: 20rem;
12
+ height: 20rem;
13
+ margin-bottom: $CAP_SPACE_12;
14
+ }
15
+
16
+ .access-denied-title-container {
17
+ gap: $CAP_SPACE_08;
18
+ margin-bottom: $CAP_SPACE_08;
19
+ }
20
+
21
+ .access-denied-description {
22
+ color: $CAP_G04;
23
+ }
14
24
  }
@@ -1,18 +1,37 @@
1
1
  import React from 'react';
2
2
  import { FormattedMessage } from 'react-intl';
3
- import { CapRow, CapHeading, CapIcon } from '@capillarytech/cap-ui-library';
3
+ import {
4
+ CapRow,
5
+ CapImage,
6
+ CapIcon,
7
+ CapHeading,
8
+ CapLabel,
9
+ } from '@capillarytech/cap-ui-library';
10
+ import accessDeniedIllustration from '@capillarytech/cap-ui-library/assets/images/createNewIllustration.svg';
4
11
  import messages from './messages';
5
12
  import './_accessForbidden.scss';
6
13
 
7
14
  const AccessForbidden = () => (
8
- <CapRow type='flex' vertical justify='center' align='middle' className="margin-t-32 text-align-center">
9
- <CapIcon type="rbac-lock" className="no-access-icon" />
10
- <CapHeading type="h3" className="no-access-title">
11
- <FormattedMessage {...messages.forbiddenHeader} />
12
- </CapHeading>
13
- <CapHeading type="h6" className="no-access-text">
15
+ <CapRow vertical align="middle" justify="center" className="access-denied">
16
+ <CapImage
17
+ src={accessDeniedIllustration}
18
+ className="access-denied-illustration"
19
+ alt=""
20
+ />
21
+ <CapRow
22
+ type="flex"
23
+ align="middle"
24
+ justify="center"
25
+ className="access-denied-title-container"
26
+ >
27
+ <CapIcon type="rbac-lock" size="m" />
28
+ <CapHeading type="h2">
29
+ <FormattedMessage {...messages.forbiddenHeader} />
30
+ </CapHeading>
31
+ </CapRow>
32
+ <CapLabel type="label2" className="access-denied-description">
14
33
  <FormattedMessage {...messages.forbiddenDesc} />
15
- </CapHeading>
34
+ </CapLabel>
16
35
  </CapRow>
17
36
  );
18
37
 
@@ -5,11 +5,10 @@ const prefix = 'creatives.components.AccessForbidden';
5
5
  export default defineMessages({
6
6
  forbiddenHeader: {
7
7
  id: `${prefix}.forbiddenHeader`,
8
- defaultMessage: "You don't have permission to view this page.",
8
+ defaultMessage: 'Access Denied',
9
9
  },
10
10
  forbiddenDesc: {
11
11
  id: `${prefix}.forbiddenDesc`,
12
- defaultMessage:
13
- 'Please contact your organisation administrator to request access.',
12
+ defaultMessage: 'This page access has not been provided to you.',
14
13
  },
15
14
  });
@@ -139,26 +139,6 @@ const UnifiedPreview = ({
139
139
  );
140
140
  }
141
141
 
142
- case CHANNELS.LINE:
143
- // LINE's real content today is a single text message (CCS's
144
- // lineMessageContent.messageBody is a JSON string of LINE's native
145
- // messages[] array — see testAndPreviewDataTransform.js's LINE case,
146
- // which already resolves it down to plain text before it reaches
147
- // here) — reuse the same simple chat-bubble preview as SMS. Rich LINE
148
- // message types (image/video/sticker/imageMap/carousel/flex) are NOT
149
- // rendered specially yet; they'll show as empty/raw text until this
150
- // gets richer LINE-specific handling.
151
- return (
152
- <SmsPreviewContent
153
- content={typeof content === 'string' ? content : (content?.resolvedBody || '')}
154
- device={device}
155
- isUpdating={isUpdating}
156
- error={error}
157
- formatMessage={formatMessage}
158
- showHeader={showHeader}
159
- />
160
- );
161
-
162
142
  case CHANNELS.WHATSAPP: {
163
143
  // WhatsApp content is an object with templateMsg, media, CTA, etc.
164
144
  const whatsappContent = typeof content === 'object' ? content : {};
@@ -85,7 +85,6 @@ export const CHANNELS = {
85
85
  VIBER: 'VIBER',
86
86
  ZALO: 'ZALO',
87
87
  WEBPUSH: 'WEBPUSH',
88
- LINE: 'LINE',
89
88
  };
90
89
 
91
90
  /** Unified preview tab keys when RCS shows RCS + SMS fallback panes. */
@@ -101,7 +100,6 @@ export const CHANNELS_USING_ANDROID_PREVIEW_DEVICE = [
101
100
  CHANNELS.INAPP,
102
101
  CHANNELS.MOBILEPUSH,
103
102
  CHANNELS.VIBER,
104
- CHANNELS.LINE,
105
103
  ];
106
104
 
107
105
  /** RCS createMessageMeta test payload — rich card envelope literals. */
@@ -1275,6 +1275,7 @@ const CommonTestAndPreview = (props) => {
1275
1275
  ...(suggestionsFormattedForTestMeta.length > 0 && {
1276
1276
  suggestions: suggestionsFormattedForTestMeta,
1277
1277
  }),
1278
+ ...(singleRcsCardPayload?.cardVarMapped && { cardVarMapped: singleRcsCardPayload.cardVarMapped }),
1278
1279
  };
1279
1280
  });
1280
1281
  // Use the component-level smsFallbackContent prop (has rcsSmsFallbackVarMapped) so DLT
@@ -1341,9 +1342,11 @@ const CommonTestAndPreview = (props) => {
1341
1342
  ...(cardContentForTestMetaApi.length > 0 && { cardContent: cardContentForTestMetaApi }),
1342
1343
  };
1343
1344
 
1345
+ const vfTemplateId = rcsContentFromForm?.vfTemplateId;
1344
1346
  const rcsMessageContent = {
1345
1347
  channel: CHANNELS.RCS,
1346
1348
  ...(accountIdForMeta && { accountId: accountIdForMeta }),
1349
+ ...(vfTemplateId && { templateId: vfTemplateId }),
1347
1350
  rcsRichCardContent,
1348
1351
  ...(smsFallBackContent && { smsFallBackContent }),
1349
1352
  };
@@ -3813,7 +3816,7 @@ const CommonTestAndPreview = (props) => {
3813
3816
  header={slideboxHeader}
3814
3817
  handleClose={handleClose}
3815
3818
  show={show}
3816
- size="size-l"
3819
+ size="size-xl"
3817
3820
  content={(
3818
3821
  <CapSpin
3819
3822
  spinning={isCustomerDataLoading}
@@ -479,112 +479,6 @@ describe('UnifiedPreview', () => {
479
479
  });
480
480
  });
481
481
 
482
- describe('Channel Routing - LINE', () => {
483
- it('should render SmsPreviewContent for LINE channel with string content', () => {
484
- const props = {
485
- ...defaultProps,
486
- channel: CHANNELS.LINE,
487
- content: 'Hello world',
488
- };
489
-
490
- render(
491
- <TestWrapper>
492
- <ComponentToRender {...props} />
493
- </TestWrapper>
494
- );
495
-
496
- expect(screen.getByTestId('sms-preview')).toBeTruthy();
497
- expect(screen.getByTestId('sms-content')).toHaveTextContent('Hello world');
498
- });
499
-
500
- it('should handle object content with resolvedBody for LINE channel', () => {
501
- const props = {
502
- ...defaultProps,
503
- channel: CHANNELS.LINE,
504
- content: {
505
- resolvedBody: 'some text',
506
- },
507
- };
508
-
509
- render(
510
- <TestWrapper>
511
- <ComponentToRender {...props} />
512
- </TestWrapper>
513
- );
514
-
515
- expect(screen.getByTestId('sms-preview')).toBeTruthy();
516
- expect(screen.getByTestId('sms-content')).toHaveTextContent('some text');
517
- });
518
-
519
- it('should not crash and render empty content for LINE channel when content is undefined', () => {
520
- const props = {
521
- ...defaultProps,
522
- channel: CHANNELS.LINE,
523
- content: undefined,
524
- };
525
-
526
- render(
527
- <TestWrapper>
528
- <ComponentToRender {...props} />
529
- </TestWrapper>
530
- );
531
-
532
- expect(screen.getByTestId('sms-preview')).toBeTruthy();
533
- expect(screen.getByTestId('sms-content')).toHaveTextContent('');
534
- });
535
-
536
- it('should not crash and render empty content for LINE channel when content is null', () => {
537
- const props = {
538
- ...defaultProps,
539
- channel: CHANNELS.LINE,
540
- content: null,
541
- };
542
-
543
- render(
544
- <TestWrapper>
545
- <ComponentToRender {...props} />
546
- </TestWrapper>
547
- );
548
-
549
- expect(screen.getByTestId('sms-preview')).toBeTruthy();
550
- expect(screen.getByTestId('sms-content')).toHaveTextContent('');
551
- });
552
-
553
- it('should render empty content for LINE channel when content is not a string and has no resolvedBody', () => {
554
- const props = {
555
- ...defaultProps,
556
- channel: CHANNELS.LINE,
557
- content: { someOtherField: 'value' },
558
- };
559
-
560
- render(
561
- <TestWrapper>
562
- <ComponentToRender {...props} />
563
- </TestWrapper>
564
- );
565
-
566
- expect(screen.getByTestId('sms-preview')).toBeTruthy();
567
- expect(screen.getByTestId('sms-content')).toHaveTextContent('');
568
- });
569
-
570
- it('should not render the Unknown Channel fallback for LINE channel', () => {
571
- const props = {
572
- ...defaultProps,
573
- channel: CHANNELS.LINE,
574
- content: 'Hello world',
575
- };
576
-
577
- render(
578
- <TestWrapper>
579
- <ComponentToRender {...props} />
580
- </TestWrapper>
581
- );
582
-
583
- expect(screen.queryByText('Unknown Channel')).toBeNull();
584
- expect(screen.getByTestId('sms-preview')).toBeTruthy();
585
- });
586
- });
587
-
588
482
  describe('Channel Routing - WHATSAPP', () => {
589
483
  it('should render WhatsAppPreviewContent for WHATSAPP channel', () => {
590
484
  const props = {
@@ -42,7 +42,6 @@ import {
42
42
  CLEAR_PREVIEW_ERRORS,
43
43
  // Channel Constants
44
44
  CHANNELS,
45
- CHANNELS_USING_ANDROID_PREVIEW_DEVICE,
46
45
  // Device Constants
47
46
  DESKTOP,
48
47
  MOBILE,
@@ -181,22 +180,15 @@ describe('CommonTestAndPreview Constants', () => {
181
180
  expect(CHANNELS.VIBER).toBe('VIBER');
182
181
  expect(CHANNELS.ZALO).toBe('ZALO');
183
182
  expect(CHANNELS.WEBPUSH).toBe('WEBPUSH');
184
- expect(CHANNELS.LINE).toBe('LINE');
185
183
  });
186
184
 
187
185
  it('should have all required channel keys', () => {
188
- const expectedChannels = ['EMAIL', 'SMS', 'RCS', 'WHATSAPP', 'INAPP', 'MOBILEPUSH', 'VIBER', 'ZALO', 'WEBPUSH', 'LINE'];
186
+ const expectedChannels = ['EMAIL', 'SMS', 'RCS', 'WHATSAPP', 'INAPP', 'MOBILEPUSH', 'VIBER', 'ZALO', 'WEBPUSH'];
189
187
  expect(Object.keys(CHANNELS)).toEqual(expect.arrayContaining(expectedChannels));
190
188
  expect(Object.keys(CHANNELS).length).toBe(expectedChannels.length);
191
189
  });
192
190
  });
193
191
 
194
- describe('CHANNELS_USING_ANDROID_PREVIEW_DEVICE', () => {
195
- it('should include CHANNELS.LINE', () => {
196
- expect(CHANNELS_USING_ANDROID_PREVIEW_DEVICE).toContain(CHANNELS.LINE);
197
- });
198
- });
199
-
200
192
  describe('Device Constants', () => {
201
193
  it('should export all device constants with correct values', () => {
202
194
  expect(DESKTOP).toBe('desktop');
@@ -4,7 +4,7 @@ export const MFE_MODULE_HEADER = {
4
4
  header: {
5
5
  name: 'app.commonUtils.capUiLibrary.navigationSPA.moduleHeader.creatives.default.name',
6
6
  description: 'app.commonUtils.capUiLibrary.navigationSPA.moduleHeader.creatives.default.description',
7
- showBorder: false,
7
+ showBorder: true,
8
8
  showSettings: false,
9
9
  },
10
10
  landingRoutes: [
@@ -141,8 +141,8 @@ exports[`<Cap /> should render correct component 1`] = `
141
141
  "app.v2containers.SmsTrai.Edit.traiEditTitle": "Message",
142
142
  "app.v2containers.SmsTrai.Edit.unicodeLabel": "Allow unicode characters",
143
143
  "app.v2containers.SmsTrai.Edit.unsupportedTagsValidationError": "Unsupported tags: {unsupportedTags}. Please remove them from this message.",
144
- "creatives.components.AccessForbidden.forbiddenDesc": "Please contact your organisation administrator to request access.",
145
- "creatives.components.AccessForbidden.forbiddenHeader": "You don't have permission to view this page.",
144
+ "creatives.components.AccessForbidden.forbiddenDesc": "This page access has not been provided to you.",
145
+ "creatives.components.AccessForbidden.forbiddenHeader": "Access Denied",
146
146
  "creatives.components.BreadCrumbs.header": "This is the BreadCrumbs component !",
147
147
  "creatives.components.CapTagList.Cancel": "Cancel",
148
148
  "creatives.components.CapTagList.Ok": "Ok",