@capillarytech/creatives-library 8.0.125 → 8.0.127-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/config/app.js +6 -0
- package/containers/App/constants.js +1 -0
- package/index.html +3 -1
- package/initialReducer.js +2 -0
- package/package.json +1 -1
- package/services/api.js +94 -1
- package/services/tests/api.test.js +191 -0
- package/tests/integration/TemplateCreation/TemplateCreation.integration.test.js +8 -3
- package/tests/integration/TemplateCreation/api-response.js +5 -0
- package/tests/integration/TemplateCreation/msw-handler.js +42 -63
- package/utils/common.js +7 -0
- package/utils/commonUtils.js +2 -6
- package/utils/createPayload.js +272 -0
- package/utils/tests/createPayload.test.js +761 -0
- package/v2Components/CapImageUpload/index.js +59 -46
- package/v2Components/CapInAppCTA/index.js +1 -0
- package/v2Components/CapMpushCTA/constants.js +25 -0
- package/v2Components/CapMpushCTA/index.js +332 -0
- package/v2Components/CapMpushCTA/index.scss +95 -0
- package/v2Components/CapMpushCTA/messages.js +89 -0
- package/v2Components/CapTagList/index.js +177 -120
- package/v2Components/CapVideoUpload/constants.js +3 -0
- package/v2Components/CapVideoUpload/index.js +167 -110
- package/v2Components/CapVideoUpload/messages.js +16 -0
- package/v2Components/Carousel/index.js +15 -13
- package/v2Components/CustomerSearchSection/_customerSearch.scss +309 -0
- package/v2Components/CustomerSearchSection/constants.js +5 -0
- package/v2Components/CustomerSearchSection/index.js +367 -0
- package/v2Components/CustomerSearchSection/messages.js +20 -0
- package/v2Components/CustomerSearchSection/tests/utils.test.js +334 -0
- package/v2Components/CustomerSearchSection/utils.js +49 -0
- package/v2Components/ErrorInfoNote/style.scss +1 -0
- package/v2Components/MobilePushPreviewV2/index.js +37 -5
- package/v2Components/TemplatePreview/_templatePreview.scss +114 -72
- package/v2Components/TemplatePreview/assets/images/Android _ With date and time.svg +29 -0
- package/v2Components/TemplatePreview/assets/images/android.svg +9 -0
- package/v2Components/TemplatePreview/assets/images/iOS _ With date and time.svg +26 -0
- package/v2Components/TemplatePreview/assets/images/ios.svg +9 -0
- package/v2Components/TemplatePreview/index.js +178 -50
- package/v2Components/TemplatePreview/messages.js +4 -0
- package/v2Components/TestAndPreviewSlidebox/CustomValuesEditor.js +169 -0
- package/v2Components/TestAndPreviewSlidebox/LeftPanelContent.js +95 -0
- package/v2Components/TestAndPreviewSlidebox/PreviewSection.js +69 -0
- package/v2Components/TestAndPreviewSlidebox/SendTestMessage.js +68 -0
- package/v2Components/TestAndPreviewSlidebox/_testAndPreviewSlidebox.scss +543 -0
- package/v2Components/TestAndPreviewSlidebox/actions.js +67 -0
- package/v2Components/TestAndPreviewSlidebox/constants.js +67 -0
- package/v2Components/TestAndPreviewSlidebox/index.js +592 -0
- package/v2Components/TestAndPreviewSlidebox/messages.js +147 -0
- package/v2Components/TestAndPreviewSlidebox/reducer.js +233 -0
- package/v2Components/TestAndPreviewSlidebox/sagas.js +258 -0
- package/v2Components/TestAndPreviewSlidebox/selectors.js +142 -0
- package/v2Components/TestAndPreviewSlidebox/tests/CustomValuesEditor.test.js +425 -0
- package/v2Components/TestAndPreviewSlidebox/tests/LeftPanelContent.test.js +400 -0
- package/v2Components/TestAndPreviewSlidebox/tests/SendTestMessage.test.js +448 -0
- package/v2Components/TestAndPreviewSlidebox/tests/actions.test.js +80 -0
- package/v2Components/TestAndPreviewSlidebox/tests/reducer.test.js +367 -0
- package/v2Components/TestAndPreviewSlidebox/tests/saga.rtl.test.js +192 -0
- package/v2Components/TestAndPreviewSlidebox/tests/saga.test.js +652 -0
- package/v2Components/TestAndPreviewSlidebox/tests/selector.test.js +182 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +22 -10
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +23 -2
- package/v2Containers/CreativesContainer/index.js +216 -136
- package/v2Containers/CreativesContainer/messages.js +4 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +21 -0
- package/v2Containers/Email/index.js +27 -2
- package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +10 -0
- package/v2Containers/EmailWrapper/index.js +6 -0
- package/v2Containers/InApp/constants.js +1 -0
- package/v2Containers/InApp/index.js +13 -13
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +3 -0
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +2 -0
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +2 -0
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +9 -0
- package/v2Containers/MobilePush/Create/index.js +1 -0
- package/v2Containers/MobilePush/commonMethods.js +7 -14
- package/v2Containers/MobilePushNew/actions.js +116 -0
- package/v2Containers/MobilePushNew/components/CtaButtons.js +170 -0
- package/v2Containers/MobilePushNew/components/MediaUploaders.js +754 -0
- package/v2Containers/MobilePushNew/components/PlatformContentFields.js +279 -0
- package/v2Containers/MobilePushNew/components/index.js +5 -0
- package/v2Containers/MobilePushNew/components/tests/CtaButtons.test.js +779 -0
- package/v2Containers/MobilePushNew/components/tests/MediaUploaders.test.js +2114 -0
- package/v2Containers/MobilePushNew/components/tests/PlatformContentFields.test.js +343 -0
- package/v2Containers/MobilePushNew/constants.js +115 -0
- package/v2Containers/MobilePushNew/hooks/tests/usePlatformSync.test.js +1299 -0
- package/v2Containers/MobilePushNew/hooks/tests/useUpload.test.js +1223 -0
- package/v2Containers/MobilePushNew/hooks/usePlatformSync.js +246 -0
- package/v2Containers/MobilePushNew/hooks/useUpload.js +726 -0
- package/v2Containers/MobilePushNew/index.js +2280 -0
- package/v2Containers/MobilePushNew/index.scss +308 -0
- package/v2Containers/MobilePushNew/messages.js +226 -0
- package/v2Containers/MobilePushNew/reducer.js +160 -0
- package/v2Containers/MobilePushNew/sagas.js +198 -0
- package/v2Containers/MobilePushNew/selectors.js +55 -0
- package/v2Containers/MobilePushNew/tests/reducer.test.js +741 -0
- package/v2Containers/MobilePushNew/tests/sagas.test.js +863 -0
- package/v2Containers/MobilePushNew/tests/selectors.test.js +425 -0
- package/v2Containers/MobilePushNew/tests/utils.test.js +322 -0
- package/v2Containers/MobilePushNew/utils.js +33 -0
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +23 -5
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4 -0
- package/v2Containers/TagList/index.js +56 -10
- package/v2Containers/Templates/_templates.scss +101 -1
- package/v2Containers/Templates/index.js +147 -35
- package/v2Containers/Templates/messages.js +8 -0
- package/v2Containers/Templates/sagas.js +2 -0
- package/v2Containers/Whatsapp/constants.js +1 -0
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +35 -0
- package/v2Containers/Email/tests/index.test.js +0 -35
|
@@ -219,6 +219,106 @@
|
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
|
+
|
|
223
|
+
.MOBILEPUSH {
|
|
224
|
+
.ant-card-body {
|
|
225
|
+
padding: 0;
|
|
226
|
+
background-color: $CAP_WHITE;
|
|
227
|
+
border-top: 1px solid $CAP_COLOR_16;
|
|
228
|
+
.ant-card-meta {
|
|
229
|
+
background-color: $CAP_G09;
|
|
230
|
+
padding: 0;
|
|
231
|
+
.ant-card-meta-description {
|
|
232
|
+
.mobilepush-container {
|
|
233
|
+
background-color: $CAP_WHITE;
|
|
234
|
+
padding: $CAP_SPACE_12;
|
|
235
|
+
.app-header {
|
|
236
|
+
color: #5D5D5D;
|
|
237
|
+
font-weight: 600;
|
|
238
|
+
padding: 0.285rem 0.571rem 0.285rem 0.571rem;
|
|
239
|
+
display: flex;
|
|
240
|
+
align-items: center;
|
|
241
|
+
justify-content: space-between;
|
|
242
|
+
.app-header-left{
|
|
243
|
+
display: flex;
|
|
244
|
+
align-items: center;
|
|
245
|
+
div {
|
|
246
|
+
word-break: break-word;
|
|
247
|
+
}
|
|
248
|
+
.app-icon {
|
|
249
|
+
width: 0.857rem;
|
|
250
|
+
height: 0.857rem;
|
|
251
|
+
border-radius: 50%;
|
|
252
|
+
background-color: #737070;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
.mobilepush-message {
|
|
257
|
+
padding-left: 1.65rem;
|
|
258
|
+
}
|
|
259
|
+
.mobilepush-image {
|
|
260
|
+
width: 100%;
|
|
261
|
+
height: 120px;
|
|
262
|
+
margin-top: 10px;
|
|
263
|
+
}
|
|
264
|
+
.mobilepush-image-padding {
|
|
265
|
+
padding-left: 1.65rem;
|
|
266
|
+
}
|
|
267
|
+
.scroll-container {
|
|
268
|
+
overflow-x: auto;
|
|
269
|
+
display: flex;
|
|
270
|
+
padding-top: $CAP_SPACE_06;
|
|
271
|
+
padding-right: $CAP_SPACE_06;
|
|
272
|
+
white-space: nowrap;
|
|
273
|
+
scrollbar-width: none; // Hide scrollbar in Firefox
|
|
274
|
+
&::-webkit-scrollbar {
|
|
275
|
+
display: none; // Hide scrollbar in Chrome/Safari/Opera
|
|
276
|
+
}
|
|
277
|
+
overflow: hidden;
|
|
278
|
+
height: 100%;
|
|
279
|
+
width: 100%;
|
|
280
|
+
margin-left: 1.65rem;
|
|
281
|
+
.whatsapp-carousel-container {
|
|
282
|
+
padding: $CAP_SPACE_04 0px $CAP_SPACE_08;
|
|
283
|
+
border-radius: $CAP_SPACE_06;
|
|
284
|
+
background-color: $CAP_WHITE;
|
|
285
|
+
width: 80%;
|
|
286
|
+
flex-shrink: 0;
|
|
287
|
+
white-space: pre-wrap;
|
|
288
|
+
word-break: break-word;
|
|
289
|
+
overflow: auto;
|
|
290
|
+
text-align: left;
|
|
291
|
+
margin: 0;
|
|
292
|
+
.whatsapp-carousel-card {
|
|
293
|
+
margin: $CAP_SPACE_02 $CAP_SPACE_02 $CAP_SPACE_01 $CAP_SPACE_02;
|
|
294
|
+
.whatsapp-carousel-body {
|
|
295
|
+
margin-bottom: $CAP_SPACE_08;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
.actions{
|
|
301
|
+
background-color: #ffffff;
|
|
302
|
+
height: auto;
|
|
303
|
+
padding: $CAP_SPACE_08;
|
|
304
|
+
text-align: center;
|
|
305
|
+
display: flex;
|
|
306
|
+
flex-direction: column;
|
|
307
|
+
align-items: center;
|
|
308
|
+
justify-content: center;
|
|
309
|
+
gap: $CAP_SPACE_08;
|
|
310
|
+
.action{
|
|
311
|
+
font-size: $FONT_SIZE_S;
|
|
312
|
+
font-weight: 600;
|
|
313
|
+
color: #1970DA;
|
|
314
|
+
height: 1.25rem;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
222
322
|
}
|
|
223
323
|
|
|
224
324
|
.create-new-link{
|
|
@@ -502,7 +602,7 @@
|
|
|
502
602
|
}
|
|
503
603
|
}
|
|
504
604
|
.iphone-push-message-Container{
|
|
505
|
-
top:
|
|
605
|
+
top: 10%;
|
|
506
606
|
.message-pop{
|
|
507
607
|
border-radius: 4px;
|
|
508
608
|
word-wrap: break-word;
|
|
@@ -12,7 +12,7 @@ import styled from 'styled-components';
|
|
|
12
12
|
import {injectIntl, intlShape, FormattedMessage } from 'react-intl';
|
|
13
13
|
import { createStructuredSelector } from 'reselect';
|
|
14
14
|
import moment from "moment";
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
import get from 'lodash/get';
|
|
17
17
|
import isEmpty from 'lodash/isEmpty';
|
|
18
18
|
import isEqual from 'lodash/isEqual';
|
|
@@ -53,23 +53,20 @@ import {
|
|
|
53
53
|
CapSpin
|
|
54
54
|
} from "@capillarytech/cap-ui-library";
|
|
55
55
|
import { makeSelectTemplates, makeSelectTemplatesResponse } from './selectors';
|
|
56
|
-
import { makeSelectCreate as makeSelectCreateSms} from '../Sms/Create/selectors';
|
|
56
|
+
import { makeSelectCreate as makeSelectCreateSms } from '../Sms/Create/selectors';
|
|
57
57
|
import { makeSelectCreate as makeSelectCreateMobilePush } from '../MobilePush/Create/selectors';
|
|
58
|
-
import {
|
|
58
|
+
import { makeSelectMobilePushNew } from '../MobilePushNew/selectors';
|
|
59
59
|
import { makeSelectEbill as makeSelectCreateEbill } from '../Ebill/selectors';
|
|
60
60
|
import { makeSelectEmail as makeSelectCreateEmail } from '../Email/selectors';
|
|
61
61
|
import { makeSelectEdit } from '../Sms/Edit/selectors';
|
|
62
62
|
import { makeSelectLine } from '../Line/Container/selectors';
|
|
63
63
|
import { makeSelectViber } from '../Viber/selectors';
|
|
64
64
|
import { makeSelectZalo } from '../Zalo/selectors';
|
|
65
|
-
import {
|
|
66
|
-
import { getObjFromQueryParams } from '../../utils/v2common';
|
|
67
|
-
import messages from './messages';
|
|
68
|
-
import {checkUnicode} from '../../utils/smsCharCountV2';
|
|
65
|
+
import { makeSelectInApp } from '../InApp/selectors';
|
|
69
66
|
import * as actions from './actions';
|
|
70
67
|
import * as smsActions from '../Sms/Create/actions';
|
|
71
68
|
import * as mobilepushActions from '../MobilePush/Create/actions';
|
|
72
|
-
import * as
|
|
69
|
+
import * as mobilePushNewActions from '../MobilePushNew/actions';
|
|
73
70
|
import * as smsEditActions from '../Sms/Edit/actions';
|
|
74
71
|
import * as ebillActions from '../Ebill/actions';
|
|
75
72
|
import * as emailActions from '../Email/actions';
|
|
@@ -79,11 +76,16 @@ import * as facebookActions from '../Facebook/actions';
|
|
|
79
76
|
import * as whatsappActions from '../Whatsapp/actions';
|
|
80
77
|
import * as rcsActions from '../Rcs/actions';
|
|
81
78
|
import * as zaloActions from '../Zalo/actions';
|
|
79
|
+
import * as inAppActions from '../InApp/actions';
|
|
80
|
+
import * as globalActions from '../Cap/actions';
|
|
81
|
+
import { makeSelectAuthenticated } from '../Cap/selectors';
|
|
82
|
+
import { UserIsAuthenticated } from '../../utils/authWrapper';
|
|
83
|
+
import { getObjFromQueryParams } from '../../utils/v2common';
|
|
84
|
+
import messages from './messages';
|
|
85
|
+
import {checkUnicode} from '../../utils/smsCharCountV2';
|
|
82
86
|
import CardGrid from '../../v2Components/CardGrid';
|
|
83
87
|
import config from '../../config/app';
|
|
84
88
|
import './_templates.scss';
|
|
85
|
-
import * as globalActions from '../Cap/actions';
|
|
86
|
-
import { makeSelectAuthenticated } from '../Cap/selectors';
|
|
87
89
|
import * as commonUtil from '../../utils/common';
|
|
88
90
|
import Pagination from '../../v2Components/Pagination';
|
|
89
91
|
import EmailPreview from '../../v2Components/EmailPreview';
|
|
@@ -108,11 +110,6 @@ import {
|
|
|
108
110
|
WHATSAPP_STATUSES,
|
|
109
111
|
HOST_GUPSHUP,
|
|
110
112
|
CATEGORY_OPTIONS_MAP,
|
|
111
|
-
HOST_TWILIO,
|
|
112
|
-
TWILIO_CATEGORY_OPTIONS,
|
|
113
|
-
KARIX_GUPSHUP_CATEGORY_OPTIONS,
|
|
114
|
-
ICS_CATEGORY_OPTIONS,
|
|
115
|
-
HOST_ICS,
|
|
116
113
|
IMAGE,
|
|
117
114
|
VIDEO,
|
|
118
115
|
} from '../Whatsapp/constants';
|
|
@@ -147,6 +144,8 @@ import { compose } from 'redux';
|
|
|
147
144
|
import { v2TemplateSaga } from './sagas';
|
|
148
145
|
import injectSaga from '../../utils/injectSaga';
|
|
149
146
|
import { DAEMON } from '@capillarytech/vulcan-react-sdk/utils/sagaInjectorTypes';
|
|
147
|
+
import { v2MobilePushSagas } from '../MobilePushNew/sagas';
|
|
148
|
+
const withMobilePushNewSaga = injectSaga({ key: 'mobilePushNew', saga: v2MobilePushSagas, mode: DAEMON });
|
|
150
149
|
|
|
151
150
|
const { timeTracker } = GA;
|
|
152
151
|
const {CapCustomCardList} = CapCustomCard;
|
|
@@ -235,28 +234,29 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
235
234
|
searchedZaloTemplates: [],
|
|
236
235
|
searchingZaloTemplate: false,
|
|
237
236
|
zaloPreviewItemId: {},
|
|
237
|
+
uploadInProgress: false,
|
|
238
|
+
deleteConfirmationModal: false,
|
|
239
|
+
templateToDelete: {},
|
|
240
|
+
edmDefaultTemplateSelection: false,
|
|
241
|
+
edmSelectedTemplateId: '',
|
|
242
|
+
edmEmailPreview: false,
|
|
243
|
+
emailPreviewDevice: 'desktop',
|
|
244
|
+
// Add flag to prevent duplicate API calls
|
|
245
|
+
isProcessingEditResponse: false,
|
|
238
246
|
};
|
|
239
|
-
|
|
247
|
+
this.getAllTemplates = this.getAllTemplates.bind(this);
|
|
248
|
+
this.createTemplate = this.createTemplate.bind(this);
|
|
249
|
+
this.searchTemplate = this.searchTemplate.bind(this);
|
|
250
|
+
this.handleSortBy = this.handleSortBy.bind(this);
|
|
251
|
+
this.duplicateTemplate = this.duplicateTemplate.bind(this);
|
|
252
|
+
this.deleteTemplate = this.deleteTemplate.bind(this);
|
|
240
253
|
this.handleOnHoverItem = this.handleOnHoverItem.bind(this);
|
|
241
254
|
this.handleOnItemClick = this.handleOnItemClick.bind(this);
|
|
242
255
|
this.handleEditClick = this.handleEditClick.bind(this);
|
|
243
256
|
this.handlePreviewClick = this.handlePreviewClick.bind(this);
|
|
244
|
-
this.createTemplate = this.createTemplate.bind(this);
|
|
245
|
-
this.duplicateTemplate = this.duplicateTemplate.bind(this);
|
|
246
|
-
this.deleteTemplate = this.deleteTemplate.bind(this);
|
|
247
|
-
this.togglePreview = this.togglePreview.bind(this);
|
|
248
|
-
this.searchTemplate = this.searchTemplate.bind(this);
|
|
249
|
-
this.handleSortBy = this.handleSortBy.bind(this);
|
|
250
|
-
this.getCurrentWindow = this.getCurrentWindow.bind(this);
|
|
251
257
|
this.handleFrameTasks = this.handleFrameTasks.bind(this);
|
|
252
|
-
this.startTemplateCreation = this.startTemplateCreation.bind(this);
|
|
253
|
-
this.startLoading = this.startLoading.bind(this);
|
|
254
|
-
this.prepareWeChatPreviewData = this.prepareWeChatPreviewData.bind(this);
|
|
255
|
-
this.prepareWeChatMappedPreviewData = this.prepareWeChatMappedPreviewData.bind(this);
|
|
256
258
|
this.onAccountSelect = this.onAccountSelect.bind(this);
|
|
257
|
-
this.
|
|
258
|
-
this.menuOnClickEvent = this.menuOnClickEvent.bind(this);
|
|
259
|
-
this.delayTimer = 0;
|
|
259
|
+
this.onAccountSelect = this.onAccountSelect.bind(this);
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
// This function is to map the selected source account identifier and the connectionProperties data of domainPropertiesData object to get the hostName.
|
|
@@ -396,6 +396,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
396
396
|
window.addEventListener("message", this.handleFrameTasks);
|
|
397
397
|
}
|
|
398
398
|
componentWillReceiveProps(nextProps = {}) {
|
|
399
|
+
|
|
399
400
|
const params = {
|
|
400
401
|
name: this.state.searchText,
|
|
401
402
|
sortBy: this.state.sortBy,
|
|
@@ -565,6 +566,31 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
565
566
|
this.props.lineActions.clearCreateResponse();
|
|
566
567
|
}
|
|
567
568
|
|
|
569
|
+
// Check for MobilePushNew edit response - prevent duplicate calls
|
|
570
|
+
if (selectedChannel === "mobilepush" && nextProps.MobilePushNew && nextProps.MobilePushNew.editResponse && nextProps.MobilePushNew.editResponse.templateId && nextProps.MobilePushNew.editResponse.templateId !== '' && !this.state.isProcessingEditResponse) {
|
|
571
|
+
// Set flag to prevent duplicate processing
|
|
572
|
+
this.setState({ isProcessingEditResponse: true });
|
|
573
|
+
|
|
574
|
+
const message = `${this.state.channel} ${this.props.intl.formatMessage(messages.templateUpdateSuccess)}`;
|
|
575
|
+
|
|
576
|
+
CapNotification.success({
|
|
577
|
+
key: 'editSuccess',
|
|
578
|
+
message
|
|
579
|
+
});
|
|
580
|
+
|
|
581
|
+
this.getAllTemplates({params, resetPage: true});
|
|
582
|
+
|
|
583
|
+
this.props.mobilePushNewActions.clearData();
|
|
584
|
+
|
|
585
|
+
this.props.mobilePushNewActions.clearEditResponse();
|
|
586
|
+
|
|
587
|
+
// Reset flag after a delay to allow for next edit
|
|
588
|
+
setTimeout(() => {
|
|
589
|
+
this.setState({ isProcessingEditResponse: false });
|
|
590
|
+
}, 1000);
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
|
|
568
594
|
|
|
569
595
|
if (nextProps.Create && this.props.Create && nextProps.Create.createTemplateError && !isEqual(nextProps.Create.createTemplateError, this.props.Create.createTemplateError)) {
|
|
570
596
|
const message = this.props.intl.formatMessage(messages.somethingWentWrong);
|
|
@@ -1236,6 +1262,82 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1236
1262
|
break;
|
|
1237
1263
|
}
|
|
1238
1264
|
case MOBILE_PUSH:
|
|
1265
|
+
if (!commonUtil.hasNewMobilePushFeatureEnabled()) {
|
|
1266
|
+
templateData.content = template;
|
|
1267
|
+
} else {
|
|
1268
|
+
const mpushData = get(template, 'versions.base', template);
|
|
1269
|
+
const androidData = get(mpushData, 'ANDROID') || get(mpushData, 'androidContent');
|
|
1270
|
+
const iosData = get(mpushData, 'IOS') || get(mpushData, 'iosContent');
|
|
1271
|
+
let mpushListingData = androidData;
|
|
1272
|
+
if (isEmpty(androidData) || !androidData?.title) {
|
|
1273
|
+
mpushListingData = iosData;
|
|
1274
|
+
};
|
|
1275
|
+
const { title, message, expandableDetails: { style = '', image, carouselData = [], ctas = [] } = {} } = mpushListingData || {};
|
|
1276
|
+
templateData.content = (
|
|
1277
|
+
<div className='mobilepush-container'>
|
|
1278
|
+
<div className="app-header">
|
|
1279
|
+
<div className="app-header-left">
|
|
1280
|
+
<span className="app-icon">{""}</span>
|
|
1281
|
+
<CapLabel type="label4">{title}</CapLabel>
|
|
1282
|
+
</div>
|
|
1283
|
+
</div>
|
|
1284
|
+
<CapLabel className="mobilepush-message" type="label1">{message}</CapLabel>
|
|
1285
|
+
{style === 'BIG_PICTURE' && (
|
|
1286
|
+
<CapImage src={image} className="mobilepush-image mobilepush-image-padding" />
|
|
1287
|
+
)}
|
|
1288
|
+
{(style === 'MANUAL_CAROUSEL' || style === 'AUTO_CAROUSEL' || style === 'FILMSTRIP_CAROUSEL') && (
|
|
1289
|
+
<div className="scroll-container">
|
|
1290
|
+
{carouselData.map((data, index) => {
|
|
1291
|
+
return (
|
|
1292
|
+
<div
|
|
1293
|
+
key={`carousel-${index + 1}`}
|
|
1294
|
+
className="whatsapp-carousel-container"
|
|
1295
|
+
role="group"
|
|
1296
|
+
>
|
|
1297
|
+
<div className="whatsapp-carousel-card">
|
|
1298
|
+
{data?.mediaType === IMAGE.toLowerCase() && (
|
|
1299
|
+
<CapImage
|
|
1300
|
+
src={data?.imageUrl ? data?.imageUrl : whatsappImageEmptyPreview}
|
|
1301
|
+
className="whatsapp-image"
|
|
1302
|
+
/>
|
|
1303
|
+
)}
|
|
1304
|
+
{data?.mediaType === VIDEO.toLowerCase() && (
|
|
1305
|
+
<div className="video-preview">
|
|
1306
|
+
<CapImage
|
|
1307
|
+
src={data?.videoPreviewImg ? data?.videoPreviewImg : whatsappVideoEmptyPreview}
|
|
1308
|
+
className="whatsapp-image"
|
|
1309
|
+
/>
|
|
1310
|
+
<div className="icon-position">
|
|
1311
|
+
<CapImage
|
|
1312
|
+
className="video-icon"
|
|
1313
|
+
src={videoPlay}
|
|
1314
|
+
/>
|
|
1315
|
+
</div>
|
|
1316
|
+
</div>
|
|
1317
|
+
)}
|
|
1318
|
+
</div>
|
|
1319
|
+
</div>
|
|
1320
|
+
)
|
|
1321
|
+
})}
|
|
1322
|
+
</div>
|
|
1323
|
+
)}
|
|
1324
|
+
{ctas.length > 0 && (
|
|
1325
|
+
<div className="actions">
|
|
1326
|
+
{ctas.map((cta) => (
|
|
1327
|
+
<span
|
|
1328
|
+
className="action"
|
|
1329
|
+
key={`action-${cta?.actionText}`}
|
|
1330
|
+
>
|
|
1331
|
+
{cta?.actionText && cta?.actionText.toUpperCase()}
|
|
1332
|
+
</span>
|
|
1333
|
+
))}
|
|
1334
|
+
</div>
|
|
1335
|
+
)}
|
|
1336
|
+
</div>
|
|
1337
|
+
);
|
|
1338
|
+
templateData.isNewMobilePush = commonUtil.hasNewMobilePushFeatureEnabled();
|
|
1339
|
+
}
|
|
1340
|
+
break;
|
|
1239
1341
|
case INAPP:
|
|
1240
1342
|
templateData.content = template;
|
|
1241
1343
|
break;
|
|
@@ -2051,12 +2153,18 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2051
2153
|
delete duplicateObj._id;
|
|
2052
2154
|
|
|
2053
2155
|
if (this.state.channel.toLowerCase() === "mobilepush") {
|
|
2156
|
+
const params = {
|
|
2157
|
+
name: this.state.searchText,
|
|
2158
|
+
sortBy: this.state.sortBy,
|
|
2159
|
+
};
|
|
2054
2160
|
duplicateObj.definition.accountId = this.props.Templates.selectedWeChatAccount.id;
|
|
2055
|
-
this.props.
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2161
|
+
this.props.mobilePushNewActions.createTemplate(duplicateObj, (response) => {
|
|
2162
|
+
if (response && (response.templateId || response._id)) {
|
|
2163
|
+
const message = `${this.state.channel} ${this.props.intl.formatMessage(messages.templateDuplicateSuccess)}`;
|
|
2164
|
+
CapNotification.success({key: 'duplicateSuccess', message});
|
|
2165
|
+
this.getAllTemplates({params, resetPage: true});
|
|
2166
|
+
this.props.mobilePushNewActions.clearCreateResponse();
|
|
2167
|
+
}
|
|
2060
2168
|
});
|
|
2061
2169
|
} else if (this.state.channel.toLowerCase() === "inapp") {
|
|
2062
2170
|
duplicateObj.definition.accountId = this.props.Templates.selectedWeChatAccount.id;
|
|
@@ -3397,6 +3505,7 @@ Templates.propTypes = {
|
|
|
3397
3505
|
actions: PropTypes.object.isRequired,
|
|
3398
3506
|
smsActions: PropTypes.object,
|
|
3399
3507
|
mobilepushActions: PropTypes.object,
|
|
3508
|
+
mobilePushNewActions: PropTypes.object,
|
|
3400
3509
|
smsEditActions: PropTypes.object,
|
|
3401
3510
|
ebillActions: PropTypes.object,
|
|
3402
3511
|
emailActions: PropTypes.object,
|
|
@@ -3429,6 +3538,7 @@ const mapStateToProps = createStructuredSelector({
|
|
|
3429
3538
|
TemplatesList: makeSelectTemplatesResponse(),
|
|
3430
3539
|
Create: makeSelectCreateSms(),
|
|
3431
3540
|
CreateMobilePush: makeSelectCreateMobilePush(),
|
|
3541
|
+
MobilePushNew: makeSelectMobilePushNew(),
|
|
3432
3542
|
CreateEbill: makeSelectCreateEbill(),
|
|
3433
3543
|
Edit: makeSelectEdit(),
|
|
3434
3544
|
EmailCreate: makeSelectCreateEmail(),
|
|
@@ -3444,6 +3554,7 @@ function mapDispatchToProps(dispatch) {
|
|
|
3444
3554
|
actions: bindActionCreators(actions, dispatch),
|
|
3445
3555
|
smsActions: bindActionCreators(smsActions, dispatch),
|
|
3446
3556
|
mobilepushActions: bindActionCreators(mobilepushActions, dispatch),
|
|
3557
|
+
mobilePushNewActions: bindActionCreators(mobilePushNewActions, dispatch),
|
|
3447
3558
|
inAppActions: bindActionCreators(inAppActions, dispatch),
|
|
3448
3559
|
smsEditActions: bindActionCreators(smsEditActions, dispatch),
|
|
3449
3560
|
ebillActions: bindActionCreators(ebillActions, dispatch),
|
|
@@ -3467,6 +3578,7 @@ const withSaga = injectSaga({ key: 'templates', saga: v2TemplateSaga, mode: DAEM
|
|
|
3467
3578
|
export default compose(
|
|
3468
3579
|
UserIsAuthenticated,
|
|
3469
3580
|
withSaga,
|
|
3581
|
+
withMobilePushNewSaga,
|
|
3470
3582
|
withReducer,
|
|
3471
3583
|
withConnect,
|
|
3472
3584
|
)(injectIntl(Templates));
|
|
@@ -538,4 +538,12 @@ export default defineMessages({
|
|
|
538
538
|
id: `${scope}.zaloOnlyApprovedTemplates`,
|
|
539
539
|
defaultMessage: 'Only enabled/approved templates are shown here',
|
|
540
540
|
},
|
|
541
|
+
"templateCreateSuccess": {
|
|
542
|
+
id: `${scope}.templateCreateSuccess`,
|
|
543
|
+
defaultMessage: 'Template created successfully',
|
|
544
|
+
},
|
|
545
|
+
"templateUpdateSuccess": {
|
|
546
|
+
id: `${scope}.templateUpdateSuccess`,
|
|
547
|
+
defaultMessage: 'Template updated successfully',
|
|
548
|
+
},
|
|
541
549
|
});
|
|
@@ -9,6 +9,7 @@ import { saveCdnConfigs, removeAllCdnLocalStorageItems } from '../../utils/cdnTr
|
|
|
9
9
|
import { COPY_OF } from '../../containers/App/constants';
|
|
10
10
|
import { ZALO_TEMPLATE_INFO_REQUEST } from '../Zalo/constants';
|
|
11
11
|
import { getTemplateInfoById } from '../Zalo/saga';
|
|
12
|
+
import { watchCreateTemplate } from '../MobilePushNew/sagas';
|
|
12
13
|
// Individual exports for testing
|
|
13
14
|
export function* getAllTemplates(channel, queryParams) {
|
|
14
15
|
try {
|
|
@@ -252,6 +253,7 @@ export function* v2TemplateSaga() {
|
|
|
252
253
|
watchFetchWeCrmAccounts(),
|
|
253
254
|
watchGetSenderDetails(),
|
|
254
255
|
watchForGetTemplateInfoById(),
|
|
256
|
+
// watchCreateTemplate(),
|
|
255
257
|
]);
|
|
256
258
|
}
|
|
257
259
|
|