@capillarytech/creatives-library 8.0.358 → 8.0.359
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/package.json
CHANGED
|
@@ -17,7 +17,7 @@ import CapTooltip from '@capillarytech/cap-ui-library/CapTooltip';
|
|
|
17
17
|
import CapRow from '@capillarytech/cap-ui-library/CapRow';
|
|
18
18
|
import { ANDROID, IOS } from '../constants';
|
|
19
19
|
import messages from '../messages';
|
|
20
|
-
import { getWhatsappQuickReply, getWhatsappCarouselButtonView } from '../../../v2Containers/Whatsapp/utils';
|
|
20
|
+
import { getWhatsappQuickReply, getWhatsappCarouselButtonView, getWhatsappDocPreview } from '../../../v2Containers/Whatsapp/utils';
|
|
21
21
|
import { QUICK_REPLY, PHONE_NUMBER, WHATSAPP_CATEGORIES, TEMPLATE_VARIABLE_REGEX } from '../../../v2Containers/Whatsapp/constants';
|
|
22
22
|
import videoPlay from '../../../assets/videoPlay.svg';
|
|
23
23
|
import whatsappImageEmptyPreview from '../../TemplatePreview/assets/images/empty_image_preview.svg';
|
|
@@ -256,9 +256,9 @@ const WhatsAppPreviewContent = ({
|
|
|
256
256
|
)}
|
|
257
257
|
|
|
258
258
|
{/* Document Preview */}
|
|
259
|
-
{content?.
|
|
259
|
+
{content?.whatsappDocSource && content?.whatsappDocParams && (
|
|
260
260
|
<CapRow className="whatsapp-image">
|
|
261
|
-
{content.
|
|
261
|
+
{getWhatsappDocPreview(content.whatsappDocParams)}
|
|
262
262
|
</CapRow>
|
|
263
263
|
)}
|
|
264
264
|
|
package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/WhatsAppPreviewContent.test.js
CHANGED
|
@@ -27,6 +27,7 @@ jest.mock('../../../../v2Containers/Whatsapp/constants', () => ({
|
|
|
27
27
|
authentication: 'authentication',
|
|
28
28
|
},
|
|
29
29
|
TEMPLATE_VARIABLE_REGEX: /\{\{.*?\}\}/,
|
|
30
|
+
SIZE_UNITS: ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
|
|
30
31
|
}));
|
|
31
32
|
|
|
32
33
|
// Convert messages object to format expected by IntlProvider
|
|
@@ -310,7 +311,13 @@ describe('WhatsAppPreviewContent', () => {
|
|
|
310
311
|
...defaultProps,
|
|
311
312
|
content: {
|
|
312
313
|
templateMsg: 'Message',
|
|
313
|
-
|
|
314
|
+
whatsappDocSource: 'https://example.com/doc.pdf',
|
|
315
|
+
whatsappDocParams: {
|
|
316
|
+
whatsappDocImg: 'https://example.com/doc-preview.png',
|
|
317
|
+
whatsappDocName: 'test.pdf',
|
|
318
|
+
whatsappDocPages: 2,
|
|
319
|
+
whatsappDocSize: 12345,
|
|
320
|
+
},
|
|
314
321
|
},
|
|
315
322
|
};
|
|
316
323
|
|
|
@@ -320,7 +327,7 @@ describe('WhatsAppPreviewContent', () => {
|
|
|
320
327
|
</TestWrapper>
|
|
321
328
|
);
|
|
322
329
|
|
|
323
|
-
expect(screen.
|
|
330
|
+
expect(screen.getByAltText('upload-document-src')).toBeTruthy();
|
|
324
331
|
});
|
|
325
332
|
});
|
|
326
333
|
|
|
@@ -3058,7 +3058,8 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
3058
3058
|
whatsappVideoSrcAndPreview?.whatsappVideoPreviewImg;
|
|
3059
3059
|
break;
|
|
3060
3060
|
case WHATSAPP_MEDIA_TYPES.DOCUMENT:
|
|
3061
|
-
mediaPreview.
|
|
3061
|
+
mediaPreview.whatsappDocSource = whatsappDocSource;
|
|
3062
|
+
mediaPreview.whatsappDocParams = whatsappDocParams;
|
|
3062
3063
|
break;
|
|
3063
3064
|
default:
|
|
3064
3065
|
break;
|
|
@@ -3136,7 +3137,9 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
3136
3137
|
whatsappVideoSrcAndPreview?.whatsappVideoPreviewImg;
|
|
3137
3138
|
break;
|
|
3138
3139
|
case WHATSAPP_MEDIA_TYPES.DOCUMENT:
|
|
3139
|
-
mediaPreview.docPreview = docPreview
|
|
3140
|
+
// Intentionally not setting mediaPreview.docPreview = docPreview here — docPreview is JSX
|
|
3141
|
+
// and this object is JSON.stringified by CommonTestAndPreview (circular ref crash).
|
|
3142
|
+
// whatsappDocParams below carries the raw data; WhatsAppPreviewContent renders from that.
|
|
3140
3143
|
break;
|
|
3141
3144
|
default:
|
|
3142
3145
|
break;
|