@capillarytech/creatives-library 8.0.332 → 8.0.334-alpha.0
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 +1 -1
- package/services/api.js +20 -0
- package/services/tests/api.test.js +59 -0
- package/v2Components/CapCustomSkeleton/index.js +1 -1
- package/v2Components/CapCustomSkeleton/tests/__snapshots__/index.test.js.snap +12 -12
- package/v2Containers/Assets/images/archive_Empty_Illustration.svg +9 -0
- package/v2Containers/CreativesContainer/index.js +6 -7
- package/v2Containers/Rcs/index.js +0 -7
- package/v2Containers/Templates/ChannelTypeIllustration.js +23 -6
- package/v2Containers/Templates/_templates.scss +99 -24
- package/v2Containers/Templates/actions.js +36 -0
- package/v2Containers/Templates/constants.js +23 -0
- package/v2Containers/Templates/index.js +287 -30
- package/v2Containers/Templates/messages.js +68 -0
- package/v2Containers/Templates/reducer.js +68 -0
- package/v2Containers/Templates/sagas.js +89 -1
- package/v2Containers/Templates/selectors.js +12 -0
- package/v2Containers/Templates/tests/ChannelTypeIllustration.test.js +12 -0
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1375 -1114
- package/v2Containers/Templates/tests/index.test.js +6 -0
- package/v2Containers/Templates/tests/reducer.test.js +178 -0
- package/v2Containers/Templates/tests/sagas.test.js +306 -8
- package/v2Containers/Templates/tests/selector.test.js +32 -0
|
@@ -762,7 +762,6 @@ export class Creatives extends React.Component {
|
|
|
762
762
|
smsFallBackContent = {},
|
|
763
763
|
creativeName = "",
|
|
764
764
|
channel = constants.RCS,
|
|
765
|
-
accountId = "",
|
|
766
765
|
} = templateData || {};
|
|
767
766
|
const cardContent = (rcsContent.cardContent && rcsContent.cardContent[0]) || {};
|
|
768
767
|
const Status = RCS_STATUSES.approved || '';
|
|
@@ -777,7 +776,6 @@ export class Creatives extends React.Component {
|
|
|
777
776
|
RCS: {
|
|
778
777
|
rcsContent: {
|
|
779
778
|
...rcsContent,
|
|
780
|
-
...(accountId && !isFullMode && { accountId }),
|
|
781
779
|
cardContent: [
|
|
782
780
|
{
|
|
783
781
|
...cardContent,
|
|
@@ -1225,7 +1223,7 @@ export class Creatives extends React.Component {
|
|
|
1225
1223
|
};
|
|
1226
1224
|
}
|
|
1227
1225
|
break;
|
|
1228
|
-
case constants.FACEBOOK:
|
|
1226
|
+
case constants.FACEBOOK: {
|
|
1229
1227
|
if (template.value) {
|
|
1230
1228
|
const FacebookAd = template?.value?.versions?.base?.content?.FacebookAd;
|
|
1231
1229
|
const { type } = FacebookAd[0];
|
|
@@ -1269,8 +1267,9 @@ export class Creatives extends React.Component {
|
|
|
1269
1267
|
selectedMarketingObjective: template.value.selectedMarketingObjective,
|
|
1270
1268
|
};
|
|
1271
1269
|
}
|
|
1270
|
+
}
|
|
1272
1271
|
break;
|
|
1273
|
-
case constants.RCS:
|
|
1272
|
+
case constants.RCS: {
|
|
1274
1273
|
if (template.value) {
|
|
1275
1274
|
const { name = "", versions = {} } = {
|
|
1276
1275
|
} = template.value || {};
|
|
@@ -1280,7 +1279,6 @@ export class Creatives extends React.Component {
|
|
|
1280
1279
|
contentType = "",
|
|
1281
1280
|
cardType = "",
|
|
1282
1281
|
cardSettings = {},
|
|
1283
|
-
accountId = "",
|
|
1284
1282
|
} = get(versions, 'base.content.RCS.rcsContent', {});
|
|
1285
1283
|
const rcsContent = {
|
|
1286
1284
|
contentType,
|
|
@@ -1292,11 +1290,11 @@ export class Creatives extends React.Component {
|
|
|
1292
1290
|
channel,
|
|
1293
1291
|
creativeName: name,
|
|
1294
1292
|
rcsContent,
|
|
1295
|
-
accountId,
|
|
1296
1293
|
};
|
|
1297
1294
|
}
|
|
1295
|
+
}
|
|
1298
1296
|
break;
|
|
1299
|
-
case constants.ZALO:
|
|
1297
|
+
case constants.ZALO: {
|
|
1300
1298
|
if (template.value) {
|
|
1301
1299
|
templateData = {
|
|
1302
1300
|
...template.value,
|
|
@@ -1305,6 +1303,7 @@ export class Creatives extends React.Component {
|
|
|
1305
1303
|
delete templateData.type;
|
|
1306
1304
|
}
|
|
1307
1305
|
}
|
|
1306
|
+
}
|
|
1308
1307
|
break;
|
|
1309
1308
|
case constants.WEBPUSH: {
|
|
1310
1309
|
if (template.value) {
|
|
@@ -300,7 +300,6 @@ export const Rcs = (props) => {
|
|
|
300
300
|
const [accessToken, setAccessToken] = useState('');
|
|
301
301
|
const [hostName, setHostName] = useState('');
|
|
302
302
|
const [accountName, setAccountName] = useState('');
|
|
303
|
-
const [rcsAccount, setRcsAccount] = useState('');
|
|
304
303
|
useEffect(() => {
|
|
305
304
|
const accountObj = accountData.selectedRcsAccount || {};
|
|
306
305
|
if (!isEmpty(accountObj)) {
|
|
@@ -313,7 +312,6 @@ export const Rcs = (props) => {
|
|
|
313
312
|
setAccessToken(configs.accessToken || '');
|
|
314
313
|
setHostName(accountObj.hostName || '');
|
|
315
314
|
setAccountName(accountObj.name || '');
|
|
316
|
-
setRcsAccount(accountObj.id || '');
|
|
317
315
|
}
|
|
318
316
|
}, [accountData.selectedRcsAccount]);
|
|
319
317
|
|
|
@@ -608,10 +606,6 @@ export const Rcs = (props) => {
|
|
|
608
606
|
const mediaData = get(details, 'versions.base.content.RCS.rcsContent.cardContent[0].media', '');
|
|
609
607
|
const cardSettings = get(details, 'versions.base.content.RCS.rcsContent.cardSettings', '');
|
|
610
608
|
setMediaData(mediaData, mediaType, cardSettings);
|
|
611
|
-
if (details?.edit) {
|
|
612
|
-
const rcsAccountId = get(details, 'versions.base.content.RCS.rcsContent.accountId', '');
|
|
613
|
-
setRcsAccount(rcsAccountId);
|
|
614
|
-
}
|
|
615
609
|
}
|
|
616
610
|
}, [rcsData, templateData, isFullMode, isEditFlow]);
|
|
617
611
|
|
|
@@ -1967,7 +1961,6 @@ const splitTemplateVarString = (str) => {
|
|
|
1967
1961
|
content: {
|
|
1968
1962
|
RCS: {
|
|
1969
1963
|
rcsContent: {
|
|
1970
|
-
...(rcsAccount && !isFullMode && { accountId: rcsAccount }),
|
|
1971
1964
|
cardType: STANDALONE,
|
|
1972
1965
|
cardSettings: {
|
|
1973
1966
|
cardOrientation: isMediaTypeImage ? RCS_IMAGE_DIMENSIONS[selectedDimension]?.orientation || VERTICAL : RCS_VIDEO_THUMBNAIL_DIMENSIONS[selectedDimension]?.orientation || VERTICAL,
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import zaloillustration from '@capillarytech/cap-ui-library/assets/images/featureUiNotEnabledIllustration.svg';
|
|
4
|
+
import inAppIllustration from '@capillarytech/cap-ui-library/assets/images/featureUiNotEnabledIllustration.svg';
|
|
5
|
+
import { FormattedMessage } from 'react-intl';
|
|
6
|
+
import { CapIllustration } from "@capillarytech/cap-ui-library";
|
|
3
7
|
import emailIllustration from '../Assets/images/emailIllustration.svg';
|
|
4
8
|
import smsIllustration from '../Assets/images/smsIllustration.svg';
|
|
5
9
|
import pushIllustration from '../Assets/images/pushIllustration.svg';
|
|
@@ -8,13 +12,12 @@ import lineIllustration from '../Assets/images/lineIllustration.svg';
|
|
|
8
12
|
import facebookIllustration from '../Assets/images/facebookIllustration.svg';
|
|
9
13
|
import whatsappIllustration from '../Assets/images/whatsappIllustration.png';
|
|
10
14
|
import whatsappOrZaloAccountIllustration from '../Assets/images/whatsappOrZaloAccountIllustration.svg';
|
|
15
|
+
import archiveEmptyStateIllustration from '../Assets/images/archive_Empty_Illustration.svg';
|
|
11
16
|
import rcsIllustration from '../Assets/images/rcsIllustration.png';
|
|
12
|
-
import zaloillustration from '@capillarytech/cap-ui-library/assets/images/featureUiNotEnabledIllustration.svg';
|
|
13
|
-
import inAppIllustration from '@capillarytech/cap-ui-library/assets/images/featureUiNotEnabledIllustration.svg';
|
|
14
17
|
import messages from './messages';
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
import {
|
|
19
|
+
MOBILE_PUSH, SMS, EMAIL, LINE, VIBER, FACEBOOK, WHATSAPP, RCS, ZALO, INAPP, WEBPUSH,
|
|
20
|
+
} from '../CreativesContainer/constants';
|
|
18
21
|
|
|
19
22
|
|
|
20
23
|
// Configuration object for channel types
|
|
@@ -80,7 +83,8 @@ function ChannelTypeIllustration(props) {
|
|
|
80
83
|
isFullMode,
|
|
81
84
|
createTemplate,
|
|
82
85
|
currentChannel,
|
|
83
|
-
hostName
|
|
86
|
+
hostName,
|
|
87
|
+
isArchivedMode,
|
|
84
88
|
} = props;
|
|
85
89
|
|
|
86
90
|
const templateText = useMemo(() => {
|
|
@@ -88,6 +92,18 @@ function ChannelTypeIllustration(props) {
|
|
|
88
92
|
return isFullMode ? templateIntlMsg : '';
|
|
89
93
|
}, [isFullMode]);
|
|
90
94
|
|
|
95
|
+
if (isArchivedMode) {
|
|
96
|
+
return (
|
|
97
|
+
<CapIllustration
|
|
98
|
+
illustrationImage={archiveEmptyStateIllustration}
|
|
99
|
+
title={<FormattedMessage {...messages.noArchivedCreatives} />}
|
|
100
|
+
description={<FormattedMessage {...messages.noArchivedCreativesDesc} />}
|
|
101
|
+
descriptionPosition="bottom"
|
|
102
|
+
descriptionClassName="illustration-desc archive-illustration"
|
|
103
|
+
/>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
91
107
|
const getChannelTypeIllustrationInfo = (type, hostName) => {
|
|
92
108
|
// Handle special cases with hostName dependency
|
|
93
109
|
if (type === WHATSAPP) {
|
|
@@ -196,5 +212,6 @@ ChannelTypeIllustration.propTypes = {
|
|
|
196
212
|
createTemplate: PropTypes.func.isRequired,
|
|
197
213
|
currentChannel: PropTypes.string,
|
|
198
214
|
hostName: PropTypes.string,
|
|
215
|
+
isArchivedMode: PropTypes.bool,
|
|
199
216
|
};
|
|
200
217
|
export default ChannelTypeIllustration;
|
|
@@ -1,34 +1,22 @@
|
|
|
1
1
|
@import '~@capillarytech/cap-ui-library/styles/_variables.scss';
|
|
2
2
|
|
|
3
3
|
.ant-tabs-content{
|
|
4
|
-
margin-top:
|
|
4
|
+
margin-top: $CAP_SPACE_16;
|
|
5
5
|
.ant-tabs-tabpane-active{
|
|
6
6
|
padding: unset;
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
@media screen and (min-width: 1172px) {
|
|
25
|
-
.creatives-templates-list.full-mode{
|
|
26
|
-
.v2-pagination-container {
|
|
27
|
-
.cap-custom-card-list-row {
|
|
28
|
-
.cap-custom-card-list-col{
|
|
29
|
-
&:nth-child(4n+4) { //every 4th child
|
|
30
|
-
margin-right: unset;
|
|
31
|
-
}
|
|
10
|
+
// 3 cards per row across all breakpoints
|
|
11
|
+
.creatives-templates-list {
|
|
12
|
+
.v2-pagination-container,
|
|
13
|
+
.v2-pagination-container-half {
|
|
14
|
+
.cap-custom-card-list-row {
|
|
15
|
+
.cap-custom-card-list-col {
|
|
16
|
+
width: calc(33.33% - #{$CAP_SPACE_08});
|
|
17
|
+
margin-right: $CAP_SPACE_12;
|
|
18
|
+
&:nth-child(3n) {
|
|
19
|
+
margin-right: 0;
|
|
32
20
|
}
|
|
33
21
|
}
|
|
34
22
|
}
|
|
@@ -674,6 +662,32 @@
|
|
|
674
662
|
font-size: 14px;
|
|
675
663
|
}
|
|
676
664
|
|
|
665
|
+
// Archive/Unarchive confirm modal overrides — scoped to avoid affecting other modals
|
|
666
|
+
.archive-confirm-modal {
|
|
667
|
+
// Remove the left margin added when an icon is present
|
|
668
|
+
.ant-modal-confirm-body {
|
|
669
|
+
> .anticon + .ant-modal-confirm-title + .ant-modal-confirm-content {
|
|
670
|
+
margin-left: 0;
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
// Left-align buttons, remove float
|
|
675
|
+
.ant-modal-confirm-btns {
|
|
676
|
+
float: none;
|
|
677
|
+
display: flex;
|
|
678
|
+
align-items: center;
|
|
679
|
+
gap: $CAP_SPACE_08;
|
|
680
|
+
margin-top: $CAP_SPACE_16;
|
|
681
|
+
|
|
682
|
+
// Cancel button styling
|
|
683
|
+
.ant-btn:not(.ant-btn-primary) {
|
|
684
|
+
background-color: $CAP_G08;
|
|
685
|
+
border-color: $CAP_G08;
|
|
686
|
+
color: $CAP_G01;
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
|
|
677
691
|
.popover-action-container {
|
|
678
692
|
line-height: 24px;
|
|
679
693
|
}
|
|
@@ -1101,4 +1115,65 @@
|
|
|
1101
1115
|
.inapp-illustration-parent {
|
|
1102
1116
|
height: "calc(100vh - 325px)";
|
|
1103
1117
|
overflow: 'auto';
|
|
1104
|
-
}
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
// Archive feature layout classes
|
|
1121
|
+
.illustration-scroll-wrapper {
|
|
1122
|
+
height: calc(100vh - 20.3125rem);
|
|
1123
|
+
overflow: auto;
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
.filter-row {
|
|
1127
|
+
display: flex;
|
|
1128
|
+
align-items: center;
|
|
1129
|
+
justify-content: space-between;
|
|
1130
|
+
width: 100%;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
.filter-row-content {
|
|
1134
|
+
flex: 1;
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
.bulk-selection-bar {
|
|
1138
|
+
display: flex;
|
|
1139
|
+
align-items: center;
|
|
1140
|
+
gap: $CAP_SPACE_12;
|
|
1141
|
+
flex-shrink: 0;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
.archived-mode-header {
|
|
1145
|
+
display: flex;
|
|
1146
|
+
align-items: center;
|
|
1147
|
+
gap: $CAP_SPACE_12;
|
|
1148
|
+
margin-bottom: $CAP_SPACE_16;
|
|
1149
|
+
|
|
1150
|
+
.archived-mode-back-icon {
|
|
1151
|
+
cursor: pointer;
|
|
1152
|
+
font-size: 1.428rem;
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
.archived-tag {
|
|
1157
|
+
margin-left: $CAP_SPACE_08;
|
|
1158
|
+
font-size: 0.786rem;
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
.popover-archive-action {
|
|
1162
|
+
cursor: pointer;
|
|
1163
|
+
padding: $CAP_SPACE_08 0;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
.archive-menu-item {
|
|
1167
|
+
display: inline-flex;
|
|
1168
|
+
align-items: center;
|
|
1169
|
+
gap: $CAP_SPACE_08;
|
|
1170
|
+
margin-top: 1rem;
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
.archive-btn-label {
|
|
1174
|
+
margin-right: 0.714rem;
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
.bulk-selection-bar .cap-button-v2-prefix {
|
|
1178
|
+
margin-top: 1rem;
|
|
1179
|
+
}
|
|
@@ -167,3 +167,39 @@ export function getCdnTransformationConfig() {
|
|
|
167
167
|
type: types.GET_CDN_TRANSFORMATION_CONFIG_REQUEST,
|
|
168
168
|
};
|
|
169
169
|
}
|
|
170
|
+
|
|
171
|
+
export function archiveTemplate(channel, id, templateName) {
|
|
172
|
+
return { type: types.ARCHIVE_TEMPLATE_REQUEST, channel, id, templateName };
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export function unarchiveTemplate(channel, id, templateName) {
|
|
176
|
+
return { type: types.UNARCHIVE_TEMPLATE_REQUEST, channel, id, templateName };
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export function bulkArchiveTemplates(channel, ids) {
|
|
180
|
+
return { type: types.BULK_ARCHIVE_REQUEST, channel, ids };
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export function bulkUnarchiveTemplates(channel, ids) {
|
|
184
|
+
return { type: types.BULK_UNARCHIVE_REQUEST, channel, ids };
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export function setArchiveFilter(filter) {
|
|
188
|
+
return { type: types.SET_ARCHIVE_FILTER, filter };
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export function toggleTemplateSelection(id) {
|
|
192
|
+
return { type: types.TOGGLE_TEMPLATE_SELECTION, id };
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export function selectAllTemplates(ids) {
|
|
196
|
+
return { type: types.SELECT_ALL_TEMPLATES, ids };
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export function clearTemplateSelection() {
|
|
200
|
+
return { type: types.CLEAR_TEMPLATE_SELECTION };
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export function setArchivedMode(isArchived) {
|
|
204
|
+
return { type: types.SET_ARCHIVED_MODE, isArchived };
|
|
205
|
+
}
|
|
@@ -91,3 +91,26 @@ export const noApprovedWhatsappTemplatesDesc ='noApprovedWhatsappTemplatesDesc'
|
|
|
91
91
|
export const zaloDescIllustration='zaloDescIllustration'
|
|
92
92
|
export const noApprovedRcsTemplatesTitle='noApprovedRcsTemplatesTitle'
|
|
93
93
|
export const noApprovedRcsTemplatesDesc='noApprovedRcsTemplatesDesc'
|
|
94
|
+
|
|
95
|
+
// Archive feature
|
|
96
|
+
export const ARCHIVE_TEMPLATE_REQUEST = 'app/v2Containers/Templates/ARCHIVE_TEMPLATE_REQUEST';
|
|
97
|
+
export const ARCHIVE_TEMPLATE_SUCCESS = 'app/v2Containers/Templates/ARCHIVE_TEMPLATE_SUCCESS';
|
|
98
|
+
export const ARCHIVE_TEMPLATE_FAILURE = 'app/v2Containers/Templates/ARCHIVE_TEMPLATE_FAILURE';
|
|
99
|
+
|
|
100
|
+
export const UNARCHIVE_TEMPLATE_REQUEST = 'app/v2Containers/Templates/UNARCHIVE_TEMPLATE_REQUEST';
|
|
101
|
+
export const UNARCHIVE_TEMPLATE_SUCCESS = 'app/v2Containers/Templates/UNARCHIVE_TEMPLATE_SUCCESS';
|
|
102
|
+
export const UNARCHIVE_TEMPLATE_FAILURE = 'app/v2Containers/Templates/UNARCHIVE_TEMPLATE_FAILURE';
|
|
103
|
+
|
|
104
|
+
export const BULK_ARCHIVE_REQUEST = 'app/v2Containers/Templates/BULK_ARCHIVE_REQUEST';
|
|
105
|
+
export const BULK_ARCHIVE_SUCCESS = 'app/v2Containers/Templates/BULK_ARCHIVE_SUCCESS';
|
|
106
|
+
export const BULK_ARCHIVE_FAILURE = 'app/v2Containers/Templates/BULK_ARCHIVE_FAILURE';
|
|
107
|
+
|
|
108
|
+
export const BULK_UNARCHIVE_REQUEST = 'app/v2Containers/Templates/BULK_UNARCHIVE_REQUEST';
|
|
109
|
+
export const BULK_UNARCHIVE_SUCCESS = 'app/v2Containers/Templates/BULK_UNARCHIVE_SUCCESS';
|
|
110
|
+
export const BULK_UNARCHIVE_FAILURE = 'app/v2Containers/Templates/BULK_UNARCHIVE_FAILURE';
|
|
111
|
+
|
|
112
|
+
export const SET_ARCHIVE_FILTER = 'app/v2Containers/Templates/SET_ARCHIVE_FILTER';
|
|
113
|
+
export const TOGGLE_TEMPLATE_SELECTION = 'app/v2Containers/Templates/TOGGLE_TEMPLATE_SELECTION';
|
|
114
|
+
export const SELECT_ALL_TEMPLATES = 'app/v2Containers/Templates/SELECT_ALL_TEMPLATES';
|
|
115
|
+
export const CLEAR_TEMPLATE_SELECTION = 'app/v2Containers/Templates/CLEAR_TEMPLATE_SELECTION';
|
|
116
|
+
export const SET_ARCHIVED_MODE = 'app/v2Containers/Templates/SET_ARCHIVED_MODE';
|