@capillarytech/creatives-library 8.0.340-0 → 8.0.340-beta.0.1
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/app.js +8 -1
- package/global-styles.js +4 -0
- package/package.json +2 -2
- package/styles/components/navigation/_leftnav.scss +1 -1
- package/styles/containers/layout/_layoutPage.scss +1 -1
- package/v2Components/AccessForbidden/index.js +1 -1
- package/v2Components/CapActionButton/index.js +5 -5
- package/v2Components/CapCustomSkeleton/index.js +1 -1
- package/v2Components/CapDeviceContent/index.js +5 -5
- package/v2Components/CapDocumentUpload/index.js +1 -1
- package/v2Components/CapImageUpload/index.js +1 -1
- package/v2Components/CapInAppCTA/index.js +118 -112
- package/v2Components/CapMpushCTA/index.js +72 -66
- package/v2Components/CapTagList/index.js +23 -11
- package/v2Components/CapVideoUpload/index.js +1 -1
- package/v2Components/CapWhatsappCTA/index.js +128 -124
- package/v2Components/CapWhatsappCarouselButton/index.js +27 -29
- package/v2Components/CapWhatsappQuickReply/index.js +7 -7
- package/v2Components/Carousel/index.js +1 -1
- package/v2Components/CommonTestAndPreview/AddTestCustomer.js +1 -1
- package/v2Components/CommonTestAndPreview/CustomValuesEditor.js +10 -11
- package/v2Components/CommonTestAndPreview/CustomerCreationModal.js +1 -1
- package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +4 -4
- package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +1 -1
- package/v2Components/CommonTestAndPreview/ExistingCustomerModal.js +6 -6
- package/v2Components/CommonTestAndPreview/LeftPanelContent.js +5 -5
- package/v2Components/CommonTestAndPreview/PreviewSection.js +1 -1
- package/v2Components/CommonTestAndPreview/UnifiedPreview/DeviceFrame.js +1 -1
- package/v2Components/CommonTestAndPreview/UnifiedPreview/EmailPreviewContent.js +8 -8
- package/v2Components/CommonTestAndPreview/UnifiedPreview/InAppPreviewContent.js +14 -13
- package/v2Components/CommonTestAndPreview/UnifiedPreview/MobilePushPreviewContent.js +22 -21
- package/v2Components/CommonTestAndPreview/UnifiedPreview/PreviewHeader.js +1 -1
- package/v2Components/CommonTestAndPreview/UnifiedPreview/RcsPreviewContent.js +9 -9
- package/v2Components/CommonTestAndPreview/UnifiedPreview/SmsPreviewContent.js +13 -11
- package/v2Components/CommonTestAndPreview/UnifiedPreview/ViberPreviewContent.js +10 -10
- package/v2Components/CommonTestAndPreview/UnifiedPreview/WhatsAppPreviewContent.js +13 -12
- package/v2Components/CommonTestAndPreview/UnifiedPreview/ZaloPreviewContent.js +4 -3
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +17 -8
- package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +1 -1
- package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +30 -5
- package/v2Components/CommonTestAndPreview/index.js +3 -3
- package/v2Components/CustomerSearchSection/_customerSearch.scss +2 -1
- package/v2Components/CustomerSearchSection/index.js +9 -9
- package/v2Components/EmailMobilePreview/index.js +1 -1
- package/v2Components/ErrorInfoNote/index.js +13 -11
- package/v2Components/ErrorInfoNote/style.scss +1 -1
- package/v2Components/FormBuilder/_formBuilder.scss +1 -0
- package/v2Components/FormBuilder/index.js +32 -40
- package/v2Components/HtmlEditor/HTMLEditor.js +4 -4
- package/v2Components/HtmlEditor/_htmlEditor.scss +2 -1
- package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +1 -1
- package/v2Components/HtmlEditor/components/DeviceToggle/_deviceToggle.scss +2 -2
- package/v2Components/HtmlEditor/components/DeviceToggle/index.js +2 -2
- package/v2Components/HtmlEditor/components/EditorToolbar/PreviewModeGroup.js +2 -2
- package/v2Components/HtmlEditor/components/EditorToolbar/index.js +2 -2
- package/v2Components/HtmlEditor/components/InAppPreviewPane/index.js +1 -0
- package/v2Components/HtmlEditor/components/PreviewPane/index.js +2 -2
- package/v2Components/HtmlEditor/components/SplitContainer/SplitContainer.js +2 -2
- package/v2Components/HtmlEditor/components/SplitContainer/_splitContainer.scss +2 -1
- package/v2Components/HtmlEditor/components/ValidationPanel/index.js +6 -9
- package/v2Components/HtmlEditor/components/ValidationTabs/index.js +2 -2
- package/v2Components/NavigationBar/index.js +7 -1
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +3 -4
- package/v2Components/TemplatePreview/_templatePreview.scss +5 -3
- package/v2Components/TemplatePreview/index.js +11 -9
- package/v2Components/TestAndPreviewSlidebox/CustomValuesEditor.js +4 -4
- package/v2Components/TestAndPreviewSlidebox/LeftPanelContent.js +5 -5
- package/v2Components/TestAndPreviewSlidebox/PreviewSection.js +3 -3
- package/v2Components/TestAndPreviewSlidebox/_testAndPreviewSlidebox.scss +4 -2
- package/v2Containers/BeePopupEditor/index.js +1 -1
- package/v2Containers/CommunicationFlow/CommunicationFlow.js +5 -5
- package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/ChannelSelectionStep.js +4 -3
- package/v2Containers/CommunicationFlow/steps/CommunicationStrategyStep/CommunicationStrategyStep.js +2 -2
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/DeliverySettingsSection.js +3 -2
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/SenderDetails.js +7 -7
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/SenderDetails.scss +0 -5
- package/v2Containers/CommunicationFlow/steps/DynamicControlsStep/DynamicControlsStep.js +2 -2
- package/v2Containers/CommunicationFlow/steps/MessageTypeStep/MessageTypeStep.js +2 -2
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +1 -1
- package/v2Containers/CreativesContainer/index.js +1 -1
- package/v2Containers/Ebill/index.js +10 -9
- package/v2Containers/Email/index.js +7 -7
- package/v2Containers/Email/initialSchema.js +1 -1
- package/v2Containers/FTP/index.js +1 -1
- package/v2Containers/Facebook/Advertisement/index.js +4 -4
- package/v2Containers/Facebook/index.js +2 -2
- package/v2Containers/InApp/index.js +21 -16
- package/v2Containers/InApp/index.scss +0 -7
- package/v2Containers/InAppWrapper/components/InAppWrapperView.js +2 -2
- package/v2Containers/InappAdvance/index.js +4 -4
- package/v2Containers/LanguageProvider/index.js +3 -3
- package/v2Containers/LanguageProvider/tests/index.test.js +3 -3
- package/v2Containers/Line/Container/Image/index.js +1 -1
- package/v2Containers/Line/Container/ImageCarousel/Content.js +1 -1
- package/v2Containers/Line/Container/ImageCarousel/index.js +5 -5
- package/v2Containers/Line/Container/ImageMap/index.js +3 -3
- package/v2Containers/Line/Container/Sticker/index.js +2 -2
- package/v2Containers/Line/Container/Sticker/utils.js +1 -1
- package/v2Containers/Line/Container/Video/index.js +1 -1
- package/v2Containers/Line/Container/Wrapper/index.js +3 -3
- package/v2Containers/Line/Container/Wrapper/style.js +1 -5
- package/v2Containers/Line/Container/index.js +2 -2
- package/v2Containers/Login/components/LoginForm/index.js +34 -47
- package/v2Containers/Login/index.js +5 -5
- package/v2Containers/MobilePushNew/components/CtaButtons.js +2 -2
- package/v2Containers/MobilePushNew/components/MediaUploaders.js +9 -9
- package/v2Containers/MobilePushNew/components/PlatformContentFields.js +4 -4
- package/v2Containers/MobilePushNew/index.js +2 -2
- package/v2Containers/MobilePushNew/index.scss +9 -6
- package/v2Containers/Rcs/index.js +24 -19
- package/v2Containers/Rcs/index.scss +0 -7
- package/v2Containers/Sms/Create/_smsCreate.scss +9 -2
- package/v2Containers/Sms/SCHEMA_FORMBUILDER_MAP.md +922 -0
- package/v2Containers/Sms/initialSchema.js +7 -1
- package/v2Containers/SmsTrai/Edit/index.js +3 -2
- package/v2Containers/Templates/index.js +16 -16
- package/v2Containers/Viber/constants.js +0 -8
- package/v2Containers/Viber/index.js +19 -19
- package/v2Containers/Viber/index.scss +0 -7
- package/v2Containers/Viber/reducer.js +21 -44
- package/v2Containers/Viber/sagas.js +21 -62
- package/v2Containers/Viber/tests/index.test.js +0 -80
- package/v2Containers/Viber/tests/saga.test.js +40 -365
- package/v2Containers/WeChat/RichmediaTemplates/Create/_createRichmedia.scss +1 -1
- package/v2Containers/WeChat/RichmediaTemplates/Create/index.js +2 -2
- package/v2Containers/WebPush/Create/components/BrandIconSection.js +1 -1
- package/v2Containers/WebPush/Create/components/ButtonForm.js +2 -2
- package/v2Containers/WebPush/Create/components/ButtonList.js +4 -4
- package/v2Containers/WebPush/Create/components/ButtonsLinksSection.js +4 -4
- package/v2Containers/WebPush/Create/components/FormActions.js +3 -3
- package/v2Containers/WebPush/Create/components/MessageSection.js +2 -2
- package/v2Containers/WebPush/Create/components/NotificationTitleSection.js +2 -2
- package/v2Containers/WebPush/Create/components/_buttons.scss +2 -2
- package/v2Containers/WebPush/Create/index.scss +6 -3
- package/v2Containers/WebPush/Create/preview/WebPushPreview.js +1 -1
- package/v2Containers/Whatsapp/index.js +28 -28
- package/v2Containers/Zalo/index.js +3 -3
- package/.npmrc copy +0 -2
- package/v2Containers/Viber/tests/reducer.test.js +0 -297
|
@@ -8,6 +8,9 @@ export const response = {
|
|
|
8
8
|
sections: [
|
|
9
9
|
{
|
|
10
10
|
type: 'parent',
|
|
11
|
+
rowStyle: {
|
|
12
|
+
flexDirection: 'column',
|
|
13
|
+
},
|
|
11
14
|
childSections: [
|
|
12
15
|
{
|
|
13
16
|
type: "multicols",
|
|
@@ -26,6 +29,9 @@ export const response = {
|
|
|
26
29
|
},
|
|
27
30
|
{
|
|
28
31
|
type: "parent",
|
|
32
|
+
colStyle: {
|
|
33
|
+
width: '100%'
|
|
34
|
+
},
|
|
29
35
|
|
|
30
36
|
childSections: [
|
|
31
37
|
{
|
|
@@ -104,7 +110,7 @@ export const response = {
|
|
|
104
110
|
type: "textarea",
|
|
105
111
|
metaType: "text",
|
|
106
112
|
datatype: "string",
|
|
107
|
-
style: {marginBottom: '16px'},
|
|
113
|
+
style: {marginBottom: '16px', fontSize: '14px'},
|
|
108
114
|
required: true,
|
|
109
115
|
errorMessage: "Template content has unsupported/missing tags!",
|
|
110
116
|
placeholder: "Please input sms template content.",
|
|
@@ -646,7 +646,7 @@ export const SmsTraiEdit = (props) => {
|
|
|
646
646
|
</TraiEditTemplateDetails>
|
|
647
647
|
)}
|
|
648
648
|
<CapColumn span={14}>
|
|
649
|
-
<CapRow>
|
|
649
|
+
<CapRow useLegacy>
|
|
650
650
|
<CapHeader
|
|
651
651
|
title={formatMessage(messages.traiEditTitle)}
|
|
652
652
|
size="regular"
|
|
@@ -668,6 +668,7 @@ export const SmsTraiEdit = (props) => {
|
|
|
668
668
|
</CapRow>
|
|
669
669
|
|
|
670
670
|
<CapRow
|
|
671
|
+
useLegacy
|
|
671
672
|
style={{
|
|
672
673
|
backgroundColor: CAP_G10,
|
|
673
674
|
padding: CAP_SPACE_16,
|
|
@@ -675,7 +676,7 @@ export const SmsTraiEdit = (props) => {
|
|
|
675
676
|
>
|
|
676
677
|
{renderedContent()}
|
|
677
678
|
</CapRow>
|
|
678
|
-
<CapRow>
|
|
679
|
+
<CapRow useLegacy>
|
|
679
680
|
{smsLengthForVar()}
|
|
680
681
|
</CapRow>
|
|
681
682
|
<CapCheckbox onChange={unicodeHandler} checked={isUnicodeAllowed} disabled={disablehandler()}>
|
|
@@ -1906,7 +1906,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1906
1906
|
<span title={template?.name}>
|
|
1907
1907
|
{template?.name}
|
|
1908
1908
|
{currentChannel === INAPP && (
|
|
1909
|
-
<CapRow>
|
|
1909
|
+
<CapRow useLegacy>
|
|
1910
1910
|
<CapColoredTag
|
|
1911
1911
|
tagColor={INAPP_LAYOUT_DETAILS[inappBodyType]?.tagColor}
|
|
1912
1912
|
tagTextColor={
|
|
@@ -1937,7 +1937,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1937
1937
|
// Show preview icon for other channels (e.g., WeChat, Line, Facebook, Ebill)
|
|
1938
1938
|
if (currentChannel === ZALO && isZaloPreviewLoading) {
|
|
1939
1939
|
return (
|
|
1940
|
-
<CapSpin style={{
|
|
1940
|
+
<CapSpin style={{ position: "static", display: "inline" }} spinning />
|
|
1941
1941
|
);
|
|
1942
1942
|
}
|
|
1943
1943
|
|
|
@@ -2312,7 +2312,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2312
2312
|
case WHATSAPP: {
|
|
2313
2313
|
const { whatsappImageSrc = '', templateMsg, docPreview, whatsappVideoPreviewImg = '', templateHeaderPreview, templateFooterPreview, carouselData = [] } = getWhatsappContent(template);
|
|
2314
2314
|
templateData.title = (
|
|
2315
|
-
<CapRow>
|
|
2315
|
+
<CapRow useLegacy>
|
|
2316
2316
|
<CapLabel className="whatsapp-rcs-template-name">{template?.name}</CapLabel>
|
|
2317
2317
|
<WhatsappStatusContainer template={template} />
|
|
2318
2318
|
</CapRow>
|
|
@@ -2405,15 +2405,15 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2405
2405
|
const name = get(template, "name", "");
|
|
2406
2406
|
const statusDisplay=getRcsStatusType(status);
|
|
2407
2407
|
templateData.title = (
|
|
2408
|
-
<CapRow>
|
|
2408
|
+
<CapRow useLegacy>
|
|
2409
2409
|
<CapLabel className="whatsapp-rcs-template-name">{name}</CapLabel>
|
|
2410
|
-
<
|
|
2410
|
+
<CapColumn type="flex" align="middle" className="rcs-status-container zalo-status-color">
|
|
2411
2411
|
<CapStatus
|
|
2412
2412
|
type={statusDisplay}
|
|
2413
2413
|
text={statusDisplay && this.props.intl.formatMessage(rcsMessages?.[`${statusDisplay}_STATUS`])}
|
|
2414
2414
|
labelType="label3"
|
|
2415
2415
|
/>
|
|
2416
|
-
</
|
|
2416
|
+
</CapColumn>
|
|
2417
2417
|
</CapRow>
|
|
2418
2418
|
);
|
|
2419
2419
|
|
|
@@ -2431,11 +2431,11 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2431
2431
|
} = {},
|
|
2432
2432
|
} = template;
|
|
2433
2433
|
templateData.title = (
|
|
2434
|
-
<CapRow>
|
|
2434
|
+
<CapRow useLegacy>
|
|
2435
2435
|
<CapLabel className="zalo-template-name">
|
|
2436
2436
|
{templateId}
|
|
2437
2437
|
</CapLabel>
|
|
2438
|
-
<
|
|
2438
|
+
<CapColumn
|
|
2439
2439
|
type="flex"
|
|
2440
2440
|
align="middle"
|
|
2441
2441
|
className="zalo-status-container zalo-status-color"
|
|
@@ -2451,7 +2451,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2451
2451
|
text={status && this.props.intl.formatMessage(zaloMessages?.[`${status}_STATUS`])}
|
|
2452
2452
|
labelType="label3"
|
|
2453
2453
|
/>
|
|
2454
|
-
</
|
|
2454
|
+
</CapColumn>
|
|
2455
2455
|
</CapRow>
|
|
2456
2456
|
);
|
|
2457
2457
|
templateData.content = <CapLabel type="label19" className="zalo-listing-content desc">{template.name}</CapLabel>;
|
|
@@ -3477,8 +3477,8 @@ return (<div>
|
|
|
3477
3477
|
content = (<div className="sms-template-content">
|
|
3478
3478
|
<div style={{textAlign: 'center', lineHeight: '260px'}} className="sms-text">
|
|
3479
3479
|
<div>
|
|
3480
|
-
<button type="button" className="ant-btn cap-button edit-button ant-btn-ghost" onClick={() => this.handleBlankTemplateAction('uploadFile')}><span>Upload File</span></button>
|
|
3481
|
-
<button type="button" className="ant-btn cap-button preview-button ant-btn-danger" onClick={() => this.handleBlankTemplateAction('editor')}><span>Use Editor</span></button>
|
|
3480
|
+
<button type="button" className="ant-btn cap-button-v2 edit-button ant-btn-ghost" onClick={() => this.handleBlankTemplateAction('uploadFile')}><span>Upload File</span></button>
|
|
3481
|
+
<button type="button" className="ant-btn cap-button-v2 preview-button ant-btn-danger" onClick={() => this.handleBlankTemplateAction('editor')}><span>Use Editor</span></button>
|
|
3482
3482
|
</div>
|
|
3483
3483
|
</div>
|
|
3484
3484
|
</div>);
|
|
@@ -3488,13 +3488,13 @@ return (<div>
|
|
|
3488
3488
|
<div>
|
|
3489
3489
|
<button
|
|
3490
3490
|
type="button"
|
|
3491
|
-
className="ant-btn cap-button edit-button ant-btn-ghost"
|
|
3491
|
+
className="ant-btn cap-button-v2 edit-button ant-btn-ghost"
|
|
3492
3492
|
onClick={() => this.handleBlankTemplateAction('textTemplate', channel)}>
|
|
3493
3493
|
<span>{this.props.intl.formatMessage(messages.textTemplate)}</span>
|
|
3494
3494
|
</button>
|
|
3495
3495
|
<button
|
|
3496
3496
|
type="button"
|
|
3497
|
-
className="ant-btn cap-button preview-button ant-btn-danger"
|
|
3497
|
+
className="ant-btn cap-button-v2 preview-button ant-btn-danger"
|
|
3498
3498
|
onClick={() => this.handleBlankTemplateAction('imageTemplate', channel)}>
|
|
3499
3499
|
<span>{this.props.intl.formatMessage(messages.imageTemplate)}</span>
|
|
3500
3500
|
</button>
|
|
@@ -4453,7 +4453,7 @@ return (<div>
|
|
|
4453
4453
|
message={formatMessage(messages.zaloOnlyApprovedTemplates)}
|
|
4454
4454
|
/>
|
|
4455
4455
|
) : null}
|
|
4456
|
-
<CapRow>
|
|
4456
|
+
<CapRow useLegacy>
|
|
4457
4457
|
<Pagination
|
|
4458
4458
|
templateInProgress={
|
|
4459
4459
|
this.props.Templates.getAllTemplatesInProgress
|
|
@@ -4493,7 +4493,7 @@ return (<div>
|
|
|
4493
4493
|
)}
|
|
4494
4494
|
</CapRow>
|
|
4495
4495
|
|
|
4496
|
-
<CapRow>
|
|
4496
|
+
<CapRow useLegacy>
|
|
4497
4497
|
{!isEmpty(creativesParams.mode) &&
|
|
4498
4498
|
isFullMode && ( //creatives container for fullmode
|
|
4499
4499
|
<CreativesContainer
|
|
@@ -4517,7 +4517,7 @@ return (<div>
|
|
|
4517
4517
|
/>
|
|
4518
4518
|
)}
|
|
4519
4519
|
</CapRow>
|
|
4520
|
-
<CapRow>
|
|
4520
|
+
<CapRow useLegacy>
|
|
4521
4521
|
{(this.state.channel.toLowerCase() === "ebill" ||
|
|
4522
4522
|
this.state.channel.toLowerCase() === "email") &&
|
|
4523
4523
|
htmlPreviewContent && (
|
|
@@ -3,7 +3,6 @@ import React from 'react';
|
|
|
3
3
|
import CapHeading from "@capillarytech/cap-ui-library/CapHeading";
|
|
4
4
|
import CapLabel from "@capillarytech/cap-ui-library/CapLabel";
|
|
5
5
|
import messages from "./messages";
|
|
6
|
-
import { createAsyncAssetUploadConstants } from '../../utils/asyncAssetUpload';
|
|
7
6
|
|
|
8
7
|
export const DEFAULT_ACTION = 'app/v2Containers/Viber/DEFAULT_ACTION';
|
|
9
8
|
export const ALLOWED_EXTENSIONS_REGEX = (/\.(jpe?g|png)$/i);
|
|
@@ -17,13 +16,6 @@ export const UPLOAD_VIBER_ASSET_REQUEST = 'app/v2Containers/Viber/UPLOAD_ASSET_R
|
|
|
17
16
|
export const UPLOAD_VIBER_ASSET_SUCCESS = 'app/v2Containers/Viber/UPLOAD_ASSET_SUCCESS';
|
|
18
17
|
export const UPLOAD_VIBER_ASSET_FAILURE = 'app/v2Containers/Viber/UPLOAD_ASSET_FAILURE';
|
|
19
18
|
|
|
20
|
-
const viberAsyncPrefix = 'app/v2Containers/Viber';
|
|
21
|
-
const asyncUploadConstants = createAsyncAssetUploadConstants('VIBER', viberAsyncPrefix);
|
|
22
|
-
export const UPLOAD_VIBER_ASSET_PROCESSING = asyncUploadConstants.UPLOAD_VIBER_ASSET_PROCESSING;
|
|
23
|
-
export const UPLOAD_VIBER_ASSET_COMPLETED = asyncUploadConstants.UPLOAD_VIBER_ASSET_COMPLETED;
|
|
24
|
-
export const UPLOAD_VIBER_ASSET_FAILED = asyncUploadConstants.UPLOAD_VIBER_ASSET_FAILED;
|
|
25
|
-
export const UPLOAD_VIBER_ASSET_TIMEOUT = asyncUploadConstants.UPLOAD_VIBER_ASSET_TIMEOUT;
|
|
26
|
-
|
|
27
19
|
|
|
28
20
|
export const CREATE_VIBER_TEMPLATE_REQUEST = 'app/v2Containers/Viber/CREATE_VIBER_TEMPLATE_REQUEST';
|
|
29
21
|
export const CREATE_VIBER_TEMPLATE_SUCCESS = 'app/v2Containers/Viber/CREATE_VIBER_TEMPLATE_SUCCESS';
|
|
@@ -16,6 +16,7 @@ import CapNotification from '@capillarytech/cap-ui-library/CapNotification';
|
|
|
16
16
|
import CapTooltip from '@capillarytech/cap-ui-library/CapTooltip';
|
|
17
17
|
import CapIcon from '@capillarytech/cap-ui-library/CapIcon';
|
|
18
18
|
import CapRadioGroup from '@capillarytech/cap-ui-library/CapRadioGroup';
|
|
19
|
+
import ConfigProvider from 'antd/lib/config-provider';
|
|
19
20
|
import CapAskAira from '@capillarytech/cap-ui-library/CapAskAira';
|
|
20
21
|
import { GA } from '@capillarytech/cap-ui-utils';
|
|
21
22
|
import * as globalActions from '../Cap/actions';
|
|
@@ -375,13 +376,15 @@ export const Viber = (props) => {
|
|
|
375
376
|
<CapHeading type="h4" className="viber-render-heading">
|
|
376
377
|
{formatMessage(messages.mediaLabel)}
|
|
377
378
|
</CapHeading>
|
|
378
|
-
<
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
379
|
+
<ConfigProvider theme={{ components: { Radio: { radioSize: 20, dotSize: 8 } } }}>
|
|
380
|
+
<CapRadioGroup
|
|
381
|
+
id="viber-media-radio"
|
|
382
|
+
options={mediaRadioOptions}
|
|
383
|
+
value={templateMediaType}
|
|
384
|
+
onChange={onTemplateMediaTypeChange}
|
|
385
|
+
className="viber-media-radio"
|
|
386
|
+
/>
|
|
387
|
+
</ConfigProvider>
|
|
385
388
|
</>
|
|
386
389
|
);
|
|
387
390
|
|
|
@@ -419,7 +422,6 @@ export const Viber = (props) => {
|
|
|
419
422
|
channel={VIBER}
|
|
420
423
|
errorMessage={formatMessage(messages.videoErrorMessage)}
|
|
421
424
|
showVideoNameAndDuration
|
|
422
|
-
assetUploading={viber?.assetUploading}
|
|
423
425
|
/>
|
|
424
426
|
);
|
|
425
427
|
|
|
@@ -655,13 +657,15 @@ export const Viber = (props) => {
|
|
|
655
657
|
{formatMessage(messages.videoButtonDisabled)}
|
|
656
658
|
</CapLabel>
|
|
657
659
|
)}
|
|
658
|
-
<
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
660
|
+
<ConfigProvider theme={{ components: { Radio: { radioSize: 20, dotSize: 8 } } }}>
|
|
661
|
+
<CapRadioGroup
|
|
662
|
+
options={buttonRadioOptions}
|
|
663
|
+
value={buttonType}
|
|
664
|
+
onChange={onChangeButtonType}
|
|
665
|
+
disabled={templateMediaType === VIBER_MEDIA_TYPES.VIDEO}
|
|
666
|
+
className="viber-btn-radio-group"
|
|
667
|
+
/>
|
|
668
|
+
</ConfigProvider>
|
|
665
669
|
{isBtnTypeCta && ButtonViber}
|
|
666
670
|
</div>
|
|
667
671
|
);
|
|
@@ -796,10 +800,6 @@ export const Viber = (props) => {
|
|
|
796
800
|
) {
|
|
797
801
|
return true;
|
|
798
802
|
}
|
|
799
|
-
// block submit while a media asset upload is still in progress
|
|
800
|
-
if ((isMediaTypeImage || isMediaTypeVideo) && viber?.assetUploading) {
|
|
801
|
-
return true;
|
|
802
|
-
}
|
|
803
803
|
if (isBtnTypeCta && !isCtaSaved) {
|
|
804
804
|
return true;
|
|
805
805
|
}
|
|
@@ -6,71 +6,51 @@
|
|
|
6
6
|
|
|
7
7
|
import { fromJS } from 'immutable';
|
|
8
8
|
import * as types from './constants';
|
|
9
|
-
import { createAsyncAssetUploadReducerCases } from '../../utils/asyncAssetUpload';
|
|
10
|
-
|
|
11
|
-
const asyncUploadCases = createAsyncAssetUploadReducerCases({
|
|
12
|
-
PROCESSING: types.UPLOAD_VIBER_ASSET_PROCESSING,
|
|
13
|
-
COMPLETED: types.UPLOAD_VIBER_ASSET_COMPLETED,
|
|
14
|
-
FAILED: types.UPLOAD_VIBER_ASSET_FAILED,
|
|
15
|
-
TIMEOUT: types.UPLOAD_VIBER_ASSET_TIMEOUT,
|
|
16
|
-
});
|
|
17
9
|
|
|
18
10
|
const initialState = fromJS({
|
|
19
11
|
uploadedAssetData: {},
|
|
20
12
|
createTemplateInProgress: false,
|
|
21
|
-
assetProcessing: {},
|
|
22
13
|
});
|
|
23
14
|
|
|
24
15
|
function viberReducer(state = initialState, action) {
|
|
25
16
|
switch (action.type) {
|
|
26
17
|
case types.CREATE_VIBER_TEMPLATE_REQUEST:
|
|
27
18
|
return state
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
19
|
+
.set('createTemplateInProgress', true)
|
|
20
|
+
.set('createTemplateError', false)
|
|
21
|
+
.set('createTemplateErrorMessage', fromJS(""));
|
|
31
22
|
case types.CREATE_VIBER_TEMPLATE_SUCCESS:
|
|
32
23
|
return state.set('createTemplateInProgress', false)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
24
|
+
.set('response', action.data)
|
|
25
|
+
.set('createTemplateError', (action.statusCode !== undefined && action.statusCode > 300))
|
|
26
|
+
.set('createTemplateErrorMessage', fromJS(action.errorMsg));
|
|
36
27
|
case types.CREATE_VIBER_TEMPLATE_FAILURE:
|
|
37
28
|
return state
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
29
|
+
.set('createTemplateInProgress', false)
|
|
30
|
+
.set('createTemplateError', true)
|
|
31
|
+
.set('createTemplateErrorMessage', fromJS(action.errorMsg));
|
|
41
32
|
case types.UPLOAD_VIBER_ASSET_REQUEST:
|
|
42
33
|
return state
|
|
43
|
-
|
|
44
|
-
|
|
34
|
+
.set('uploadAssetSuccess', false)
|
|
35
|
+
.set('assetUploading', true);
|
|
45
36
|
case types.UPLOAD_VIBER_ASSET_SUCCESS:
|
|
46
37
|
return state
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
38
|
+
.set('uploadAssetSuccess', (action.statusCode !== undefined && action.statusCode !== '' && action.statusCode < 300))
|
|
39
|
+
.set('assetUploading', false)
|
|
40
|
+
.set(action.templateType !== undefined ? `uploadedAssetData${action.templateType}` : 'uploadedAssetData', action.data);
|
|
50
41
|
case types.UPLOAD_VIBER_ASSET_FAILURE:
|
|
51
42
|
return state
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
case asyncUploadCases.PROCESSING:
|
|
55
|
-
return asyncUploadCases.handleProcessing(state, action);
|
|
56
|
-
case asyncUploadCases.COMPLETED:
|
|
57
|
-
return asyncUploadCases.handleCompleted(state, action);
|
|
58
|
-
case asyncUploadCases.FAILED:
|
|
59
|
-
return asyncUploadCases.handleFailed(state, action);
|
|
60
|
-
case asyncUploadCases.TIMEOUT:
|
|
61
|
-
return asyncUploadCases.handleTimeout(state, action);
|
|
43
|
+
.set('uploadAssetSuccess', false)
|
|
44
|
+
.set('assetUploading', false);
|
|
62
45
|
case types.CLEAR_VIBER_ASSET:
|
|
63
46
|
return state
|
|
64
|
-
.delete(action.templateType !== undefined ? `uploadedAssetData${action.templateType}` : 'uploadedAssetData')
|
|
65
|
-
.set('assetProcessing', fromJS({}))
|
|
66
|
-
.set('assetUploading', false)
|
|
67
|
-
.set('uploadAssetSuccess', false);
|
|
47
|
+
.delete(action.templateType !== undefined ? `uploadedAssetData${action.templateType}` : 'uploadedAssetData');
|
|
68
48
|
// FOR EDIT
|
|
69
49
|
case types.EDIT_VIBER_TEMPLATE_REQUEST:
|
|
70
50
|
return state
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
51
|
+
.set('editTemplateInProgress', true)
|
|
52
|
+
.set('editTemplateError', false)
|
|
53
|
+
.set('editTemplateErrorMessage', fromJS(""));
|
|
74
54
|
case types.EDIT_VIBER_TEMPLATE_SUCCESS:
|
|
75
55
|
return state.set('editTemplateInProgress', false)
|
|
76
56
|
.set('editResponse', action.data)
|
|
@@ -95,10 +75,7 @@ function viberReducer(state = initialState, action) {
|
|
|
95
75
|
return state
|
|
96
76
|
.delete('uploadedAssetData')
|
|
97
77
|
.delete('metaEntities')
|
|
98
|
-
.delete('templateDetails')
|
|
99
|
-
.set('assetProcessing', fromJS({}))
|
|
100
|
-
.set('assetUploading', false)
|
|
101
|
-
.set('uploadAssetSuccess', false);
|
|
78
|
+
.delete('templateDetails');
|
|
102
79
|
default:
|
|
103
80
|
return state;
|
|
104
81
|
}
|
|
@@ -2,58 +2,17 @@ import {
|
|
|
2
2
|
call, put, takeLatest, all,
|
|
3
3
|
} from 'redux-saga/effects';
|
|
4
4
|
import * as Api from '../../services/api';
|
|
5
|
-
import { pollAssetStatus } from '../../sagas/assetPolling';
|
|
6
|
-
import { createPollingConfig } from '../../utils/asyncAssetUpload';
|
|
7
|
-
import { ASSET_STATUS } from '../../utils/assetStatusConstants';
|
|
8
5
|
import * as types from './constants';
|
|
9
6
|
|
|
10
|
-
export function* uploadViberAsset(
|
|
7
|
+
export function* uploadViberAsset(file, assetType, fileParams ) {
|
|
11
8
|
try {
|
|
12
|
-
const result = yield call(Api.uploadFile,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const assetType = params.assetType || responseData.asset?.type?.toLowerCase() || 'image';
|
|
20
|
-
|
|
21
|
-
if (assetId) {
|
|
22
|
-
yield put({
|
|
23
|
-
type: types.UPLOAD_VIBER_ASSET_PROCESSING,
|
|
24
|
-
payload: {
|
|
25
|
-
assetId,
|
|
26
|
-
asset: responseData.asset,
|
|
27
|
-
processingStatus: ASSET_STATUS.PROCESSING,
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
const actionTypes = {
|
|
32
|
-
COMPLETED: types.UPLOAD_VIBER_ASSET_COMPLETED,
|
|
33
|
-
FAILED: types.UPLOAD_VIBER_ASSET_FAILED,
|
|
34
|
-
TIMEOUT: types.UPLOAD_VIBER_ASSET_TIMEOUT,
|
|
35
|
-
};
|
|
36
|
-
const pollingConfig = createPollingConfig(assetType, assetId, actionTypes, templateType);
|
|
37
|
-
yield call(pollAssetStatus, pollingConfig);
|
|
38
|
-
} else {
|
|
39
|
-
const errorMessage = 'Asset upload initiated but no asset ID was returned from the server. Unable to track processing status.';
|
|
40
|
-
yield put({
|
|
41
|
-
type: types.UPLOAD_VIBER_ASSET_FAILED,
|
|
42
|
-
payload: {
|
|
43
|
-
assetId: undefined,
|
|
44
|
-
error: errorMessage,
|
|
45
|
-
},
|
|
46
|
-
templateType,
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
} else {
|
|
50
|
-
yield put({
|
|
51
|
-
type: types.UPLOAD_VIBER_ASSET_SUCCESS,
|
|
52
|
-
data: responseData.asset,
|
|
53
|
-
statusCode,
|
|
54
|
-
templateType: params.templateType,
|
|
55
|
-
});
|
|
56
|
-
}
|
|
9
|
+
const result = yield call(Api.uploadFile, file, assetType, fileParams);
|
|
10
|
+
yield put({
|
|
11
|
+
type: types.UPLOAD_VIBER_ASSET_SUCCESS,
|
|
12
|
+
data: result.response.asset,
|
|
13
|
+
statusCode: result.status ? result.status.code : '',
|
|
14
|
+
templateType: file.templateType,
|
|
15
|
+
});
|
|
57
16
|
} catch (error) {
|
|
58
17
|
yield put({ type: types.UPLOAD_VIBER_ASSET_FAILURE, error });
|
|
59
18
|
}
|
|
@@ -67,12 +26,7 @@ export function* createViberTemplate({ template, callback }) {
|
|
|
67
26
|
errorMsg = result.message;
|
|
68
27
|
throw errorMsg;
|
|
69
28
|
}
|
|
70
|
-
yield put({
|
|
71
|
-
type: types.CREATE_VIBER_TEMPLATE_SUCCESS,
|
|
72
|
-
data: result.response,
|
|
73
|
-
statusCode: result.status ? result.status.code : '',
|
|
74
|
-
errorMsg,
|
|
75
|
-
});
|
|
29
|
+
yield put({ type: types.CREATE_VIBER_TEMPLATE_SUCCESS, data: result.response, statusCode: result.status ? result.status.code : '', errorMsg });
|
|
76
30
|
if (callback) {
|
|
77
31
|
callback(result.response);
|
|
78
32
|
}
|
|
@@ -96,12 +50,7 @@ export function* editTemplate({ template, callback }) {
|
|
|
96
50
|
if (callback) {
|
|
97
51
|
callback(result.response);
|
|
98
52
|
}
|
|
99
|
-
yield put({
|
|
100
|
-
type: types.EDIT_VIBER_TEMPLATE_SUCCESS,
|
|
101
|
-
data: result.response,
|
|
102
|
-
statusCode: result.status ? result.status.code : '',
|
|
103
|
-
errorMsg,
|
|
104
|
-
});
|
|
53
|
+
yield put({ type: types.EDIT_VIBER_TEMPLATE_SUCCESS, data: result.response, statusCode: result.status ? result.status.code : '', errorMsg });
|
|
105
54
|
} catch (error) {
|
|
106
55
|
yield put({ type: types.EDIT_VIBER_TEMPLATE_FAILURE, error, errorMsg });
|
|
107
56
|
if (callback) {
|
|
@@ -112,6 +61,7 @@ export function* editTemplate({ template, callback }) {
|
|
|
112
61
|
|
|
113
62
|
export function* getTemplateDetails({id, callback}) {
|
|
114
63
|
try {
|
|
64
|
+
|
|
115
65
|
const result = yield call(Api.getTemplateDetails, {id, channel: 'VIBER'});
|
|
116
66
|
yield put({ type: types.GET_VIBER_TEMPLATE_DETAILS_SUCCESS, data: result.response });
|
|
117
67
|
if (callback) {
|
|
@@ -125,19 +75,28 @@ export function* getTemplateDetails({id, callback}) {
|
|
|
125
75
|
|
|
126
76
|
function* watchUploadViberAsset() {
|
|
127
77
|
yield takeLatest(types.UPLOAD_VIBER_ASSET_REQUEST, uploadViberAsset);
|
|
78
|
+
|
|
79
|
+
|
|
128
80
|
}
|
|
129
81
|
|
|
130
82
|
|
|
131
83
|
function* watchCreateTemplate() {
|
|
84
|
+
|
|
132
85
|
yield takeLatest(types.CREATE_VIBER_TEMPLATE_REQUEST, createViberTemplate);
|
|
86
|
+
|
|
87
|
+
|
|
133
88
|
}
|
|
134
89
|
|
|
135
90
|
function* watchGetTemplateDetails() {
|
|
136
91
|
yield takeLatest(types.GET_VIBER_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
|
|
92
|
+
|
|
93
|
+
|
|
137
94
|
}
|
|
138
95
|
|
|
139
96
|
function* watchEditTemplate() {
|
|
140
97
|
yield takeLatest(types.EDIT_VIBER_TEMPLATE_REQUEST, editTemplate);
|
|
98
|
+
|
|
99
|
+
|
|
141
100
|
}
|
|
142
101
|
|
|
143
102
|
export default [
|
|
@@ -154,4 +113,4 @@ export function* v2ViberSagas() {
|
|
|
154
113
|
watchGetTemplateDetails(),
|
|
155
114
|
watchEditTemplate(),
|
|
156
115
|
]);
|
|
157
|
-
}
|
|
116
|
+
}
|
|
@@ -303,84 +303,4 @@ describe('Test Viber container', () => {
|
|
|
303
303
|
});
|
|
304
304
|
expect(doneBtn).toBeDisabled();
|
|
305
305
|
});
|
|
306
|
-
|
|
307
|
-
it('disables Done while a replacement video asset is uploading (finding 1)', async () => {
|
|
308
|
-
renderComponent({
|
|
309
|
-
actions: mockActions,
|
|
310
|
-
globalActions: mockGlobalActions,
|
|
311
|
-
templateData: { mode: 'create' },
|
|
312
|
-
viber: {
|
|
313
|
-
uploadedAssetData: {},
|
|
314
|
-
createTemplateInProgress: false,
|
|
315
|
-
templateDetails: templateDetailsVideo,
|
|
316
|
-
// a new upload has started after the template was loaded
|
|
317
|
-
assetUploading: true,
|
|
318
|
-
},
|
|
319
|
-
location: {
|
|
320
|
-
pathname: '/sms/edit',
|
|
321
|
-
query: { type: false, module: 'default' },
|
|
322
|
-
search: '',
|
|
323
|
-
},
|
|
324
|
-
isFullMode: true,
|
|
325
|
-
params: { id: 'test' },
|
|
326
|
-
handleClose: jest.fn(),
|
|
327
|
-
metaEntities,
|
|
328
|
-
getDefaultTags,
|
|
329
|
-
injectedTags,
|
|
330
|
-
});
|
|
331
|
-
const doneBtn = screen.getByRole('button', { name: /done/i });
|
|
332
|
-
expect(doneBtn).toBeDisabled();
|
|
333
|
-
});
|
|
334
|
-
|
|
335
|
-
it('disables Done while an image asset is uploading (finding 1)', async () => {
|
|
336
|
-
renderComponent({
|
|
337
|
-
actions: mockActions,
|
|
338
|
-
globalActions: mockGlobalActions,
|
|
339
|
-
templateData: { mode: 'create' },
|
|
340
|
-
viber: {
|
|
341
|
-
uploadedAssetData: {},
|
|
342
|
-
createTemplateInProgress: false,
|
|
343
|
-
templateDetails: templateDetailsImage,
|
|
344
|
-
assetUploading: true,
|
|
345
|
-
},
|
|
346
|
-
location: {
|
|
347
|
-
pathname: '/sms/edit',
|
|
348
|
-
query: { type: false, module: 'default' },
|
|
349
|
-
search: '',
|
|
350
|
-
},
|
|
351
|
-
isFullMode: true,
|
|
352
|
-
params: { id: 'test' },
|
|
353
|
-
handleClose: jest.fn(),
|
|
354
|
-
});
|
|
355
|
-
const doneBtn = screen.getByRole('button', { name: /done/i });
|
|
356
|
-
expect(doneBtn).toBeDisabled();
|
|
357
|
-
});
|
|
358
|
-
|
|
359
|
-
it('keeps Done enabled when assetUploading is true but media type is text', async () => {
|
|
360
|
-
renderComponent({
|
|
361
|
-
actions: mockActions,
|
|
362
|
-
globalActions: mockGlobalActions,
|
|
363
|
-
templateData: { mode: 'create' },
|
|
364
|
-
viber: {
|
|
365
|
-
uploadedAssetData: {},
|
|
366
|
-
createTemplateInProgress: false,
|
|
367
|
-
templateDetails: templateDetailsText,
|
|
368
|
-
// stale upload flag, but the form has no media so submission is safe
|
|
369
|
-
assetUploading: true,
|
|
370
|
-
},
|
|
371
|
-
location: {
|
|
372
|
-
pathname: '/sms/edit',
|
|
373
|
-
query: { type: false, module: 'default' },
|
|
374
|
-
search: '',
|
|
375
|
-
},
|
|
376
|
-
isFullMode: true,
|
|
377
|
-
params: { id: 'test' },
|
|
378
|
-
handleClose: jest.fn(),
|
|
379
|
-
metaEntities,
|
|
380
|
-
getDefaultTags,
|
|
381
|
-
injectedTags,
|
|
382
|
-
});
|
|
383
|
-
const doneBtn = screen.getByRole('button', { name: /done/i });
|
|
384
|
-
expect(doneBtn).toBeEnabled();
|
|
385
|
-
});
|
|
386
306
|
});
|