@capillarytech/creatives-library 8.0.329 → 8.0.330
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/constants/unified.js +0 -14
- package/package.json +1 -1
- package/services/api.js +0 -17
- package/services/tests/api.test.js +0 -85
- package/utils/commonUtils.js +0 -10
- package/utils/tests/commonUtil.test.js +0 -169
- package/v2Components/CapTagList/index.js +0 -10
- package/v2Components/CommonTestAndPreview/CustomValuesEditor.js +49 -70
- package/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +2 -8
- package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +21 -207
- package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +0 -16
- package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +10 -85
- package/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +0 -30
- package/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +11 -79
- package/v2Components/CommonTestAndPreview/SendTestMessage.js +53 -87
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +1 -20
- package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +4 -133
- package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +34 -145
- package/v2Components/CommonTestAndPreview/actions.js +0 -10
- package/v2Components/CommonTestAndPreview/constants.js +1 -53
- package/v2Components/CommonTestAndPreview/index.js +168 -1006
- package/v2Components/CommonTestAndPreview/messages.js +3 -147
- package/v2Components/CommonTestAndPreview/reducer.js +0 -10
- package/v2Components/CommonTestAndPreview/sagas.js +6 -15
- package/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +286 -328
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +65 -231
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +5 -118
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +0 -341
- package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +24 -65
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +1 -199
- package/v2Components/CommonTestAndPreview/tests/constants.test.js +1 -31
- package/v2Components/CommonTestAndPreview/tests/index.test.js +4 -168
- package/v2Components/CommonTestAndPreview/tests/reducer.test.js +0 -71
- package/v2Components/CommonTestAndPreview/tests/sagas.test.js +2 -2
- package/v2Components/CommonTestAndPreview/tests/selectors.test.js +0 -17
- package/v2Components/FormBuilder/index.js +1 -7
- package/v2Components/TestAndPreviewSlidebox/index.js +1 -8
- package/v2Components/TestAndPreviewSlidebox/sagas.js +4 -11
- package/v2Components/TestAndPreviewSlidebox/tests/saga.test.js +1 -3
- package/v2Containers/CreativesContainer/SlideBoxContent.js +4 -36
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +1 -10
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +4 -29
- package/v2Containers/CreativesContainer/constants.js +0 -9
- package/v2Containers/CreativesContainer/index.js +93 -286
- package/v2Containers/CreativesContainer/index.scss +1 -51
- package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +34 -78
- package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +16 -79
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +0 -8
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +98 -357
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +10 -20
- package/v2Containers/CreativesContainer/tests/index.test.js +9 -71
- package/v2Containers/Rcs/constants.js +1 -34
- package/v2Containers/Rcs/index.js +884 -999
- package/v2Containers/Rcs/index.scss +6 -85
- package/v2Containers/Rcs/messages.js +1 -10
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +2453 -41456
- package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap +5 -0
- package/v2Containers/Rcs/tests/index.test.js +38 -41
- package/v2Containers/Rcs/tests/mockData.js +0 -38
- package/v2Containers/Rcs/tests/utils.test.js +1 -379
- package/v2Containers/Rcs/utils.js +10 -358
- package/v2Containers/Sms/Create/index.js +38 -100
- package/v2Containers/SmsTrai/Create/index.js +4 -9
- package/v2Containers/SmsTrai/Edit/constants.js +0 -2
- package/v2Containers/SmsTrai/Edit/index.js +128 -609
- package/v2Containers/SmsTrai/Edit/messages.js +4 -9
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +2600 -4586
- package/v2Containers/SmsWrapper/index.js +8 -37
- package/v2Containers/TagList/index.js +0 -6
- package/v2Containers/Templates/_templates.scss +2 -63
- package/v2Containers/Templates/actions.js +0 -11
- package/v2Containers/Templates/constants.js +0 -2
- package/v2Containers/Templates/index.js +40 -90
- package/v2Containers/Templates/sagas.js +12 -57
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1079 -1043
- package/v2Containers/Templates/tests/sagas.test.js +123 -193
- package/v2Containers/TemplatesV2/TemplatesV2.style.js +1 -72
- package/v2Containers/TemplatesV2/index.js +23 -86
- package/v2Containers/Whatsapp/index.js +20 -3
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +4872 -5790
- package/utils/templateVarUtils.js +0 -172
- package/utils/tests/templateVarUtils.test.js +0 -160
- package/v2Components/CommonTestAndPreview/AddTestCustomer.js +0 -42
- package/v2Components/CommonTestAndPreview/CustomerCreationModal.js +0 -155
- package/v2Components/CommonTestAndPreview/ExistingCustomerModal.js +0 -93
- package/v2Components/CommonTestAndPreview/previewApiUtils.js +0 -59
- package/v2Components/CommonTestAndPreview/tests/AddTestCustomer.test.js +0 -66
- package/v2Components/CommonTestAndPreview/tests/CommonTestAndPreview.addTestCustomer.test.js +0 -648
- package/v2Components/CommonTestAndPreview/tests/CustomerCreationModal.test.js +0 -174
- package/v2Components/CommonTestAndPreview/tests/ExistingCustomerModal.test.js +0 -114
- package/v2Components/CommonTestAndPreview/tests/previewApiUtils.test.js +0 -67
- package/v2Components/SmsFallback/SmsFallbackLocalSelector.js +0 -87
- package/v2Components/SmsFallback/constants.js +0 -73
- package/v2Components/SmsFallback/index.js +0 -955
- package/v2Components/SmsFallback/index.scss +0 -265
- package/v2Components/SmsFallback/messages.js +0 -78
- package/v2Components/SmsFallback/smsFallbackUtils.js +0 -107
- package/v2Components/SmsFallback/tests/SmsFallbackLocalSelector.test.js +0 -50
- package/v2Components/SmsFallback/tests/rcsSmsFallback.acceptance.test.js +0 -147
- package/v2Components/SmsFallback/tests/smsFallbackHandlers.test.js +0 -304
- package/v2Components/SmsFallback/tests/smsFallbackUi.test.js +0 -197
- package/v2Components/SmsFallback/tests/smsFallbackUtils.test.js +0 -261
- package/v2Components/SmsFallback/tests/useLocalTemplateList.test.js +0 -422
- package/v2Components/SmsFallback/useLocalTemplateList.js +0 -92
- package/v2Components/VarSegmentMessageEditor/constants.js +0 -2
- package/v2Components/VarSegmentMessageEditor/index.js +0 -125
- package/v2Components/VarSegmentMessageEditor/index.scss +0 -46
- package/v2Containers/CreativesContainer/CreativesSlideBoxWrapper.js +0 -43
- package/v2Containers/CreativesContainer/embeddedSlideboxUtils.js +0 -67
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.localTemplates.test.js +0 -90
- package/v2Containers/CreativesContainer/tests/embeddedSlideboxUtils.test.js +0 -258
- package/v2Containers/CreativesContainer/tests/useLocalTemplatesProp.test.js +0 -125
- package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +0 -205
- package/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +0 -251
- package/v2Containers/Sms/smsFormDataHelpers.js +0 -67
- package/v2Containers/Sms/tests/smsFormDataHelpers.test.js +0 -253
- package/v2Containers/SmsTrai/Edit/index.scss +0 -121
- package/v2Containers/Templates/TemplatesActionBar.js +0 -101
- package/v2Containers/Templates/tests/TemplatesActionBar.test.js +0 -120
- package/v2Containers/Templates/tests/smsTemplatesListApi.test.js +0 -180
- package/v2Containers/Templates/utils/smsTemplatesListApi.js +0 -79
- package/v2Containers/TemplatesV2/tests/TemplatesV2.localTemplates.test.js +0 -131
|
@@ -10,14 +10,12 @@ import { isTraiDLTEnable } from '../../utils/common';
|
|
|
10
10
|
import SmsEdit from '../Sms/Edit';
|
|
11
11
|
import SmsTraiCreate from '../SmsTrai/Create';
|
|
12
12
|
import SmsTraiEdit from '../SmsTrai/Edit';
|
|
13
|
-
|
|
14
13
|
const SmsWrapper = (props) => {
|
|
15
14
|
const {
|
|
16
15
|
isCreateSms,
|
|
17
16
|
isEditSms,
|
|
18
17
|
setIsLoadingContent,
|
|
19
18
|
location,
|
|
20
|
-
route: routeFromProps,
|
|
21
19
|
isGetFormData,
|
|
22
20
|
getFormSubscriptionData,
|
|
23
21
|
isFullMode,
|
|
@@ -39,33 +37,15 @@ const SmsWrapper = (props) => {
|
|
|
39
37
|
handleCloseTestAndPreview,
|
|
40
38
|
isTestAndPreviewMode,
|
|
41
39
|
onValidationFail,
|
|
42
|
-
embeddedSmsFallback = false,
|
|
43
|
-
onEmbeddedSmsFooterValidity,
|
|
44
|
-
forceFullTagContext = false,
|
|
45
40
|
} = props;
|
|
46
41
|
|
|
47
|
-
/** FormBuilder / SMS Create assume `location.query`; connected-router shapes may omit it. */
|
|
48
|
-
const smsLocation = (() => {
|
|
49
|
-
const loc = location || {};
|
|
50
|
-
const q = loc.query;
|
|
51
|
-
if (q && typeof q === 'object') {
|
|
52
|
-
return { ...loc, query: { ...q } };
|
|
53
|
-
}
|
|
54
|
-
return {
|
|
55
|
-
pathname: loc.pathname || '/sms/create',
|
|
56
|
-
search: loc.search || '',
|
|
57
|
-
query: { type: 'embedded', module: 'library' },
|
|
58
|
-
};
|
|
59
|
-
})();
|
|
60
|
-
|
|
61
42
|
const smsProps = {
|
|
62
43
|
onCreateComplete,
|
|
63
44
|
setIsLoadingContent,
|
|
64
|
-
location
|
|
65
|
-
route:
|
|
45
|
+
location,
|
|
46
|
+
route: { name: 'sms' },
|
|
66
47
|
isGetFormData,
|
|
67
48
|
getFormSubscriptionData,
|
|
68
|
-
templateData,
|
|
69
49
|
getDefaultTags,
|
|
70
50
|
isFullMode,
|
|
71
51
|
forwardedTags,
|
|
@@ -80,33 +60,24 @@ const SmsWrapper = (props) => {
|
|
|
80
60
|
handleCloseTestAndPreview,
|
|
81
61
|
isTestAndPreviewMode,
|
|
82
62
|
onValidationFail,
|
|
83
|
-
forceFullTagContext,
|
|
84
|
-
embeddedSmsFallback,
|
|
85
|
-
onEmbeddedSmsFooterValidity,
|
|
86
|
-
...(embeddedSmsFallback
|
|
87
|
-
? {
|
|
88
|
-
tagListGetPopupContainer: () => document.body,
|
|
89
|
-
tagListPopoverOverlayStyle: { zIndex: 10020 },
|
|
90
|
-
tagListPopoverOverlayClassName: 'sms-fallback-taglist-popover rcs-sms-fallback-taglist-popover',
|
|
91
|
-
}
|
|
92
|
-
: {}),
|
|
93
63
|
};
|
|
94
|
-
const
|
|
64
|
+
const isTraiDlt = isTraiDLTEnable(isFullMode, smsRegister);
|
|
95
65
|
return <>
|
|
96
66
|
{
|
|
97
|
-
isCreateSms && (
|
|
67
|
+
isCreateSms && (isTraiDlt ?
|
|
98
68
|
<SmsTraiCreate
|
|
99
69
|
isComponent
|
|
100
70
|
{...smsProps}
|
|
101
71
|
onShowTemplates={onShowTemplates}
|
|
102
72
|
/> :
|
|
103
73
|
<SmsCreate
|
|
104
|
-
isComponent
|
|
105
|
-
|
|
74
|
+
isComponent {
|
|
75
|
+
...smsProps
|
|
76
|
+
}
|
|
106
77
|
/>
|
|
107
78
|
)
|
|
108
79
|
}
|
|
109
|
-
{isEditSms && (
|
|
80
|
+
{isEditSms && (isTraiDlt ?
|
|
110
81
|
<SmsTraiEdit
|
|
111
82
|
{...smsProps}
|
|
112
83
|
params={{id: templateData._id}}
|
|
@@ -427,9 +427,6 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
427
427
|
disableTooltipMsg={tooltipMsg}
|
|
428
428
|
fetchingSchemaError={this?.state?.tagsError}
|
|
429
429
|
popoverPlacement={this.props.popoverPlacement}
|
|
430
|
-
overlayStyle={this.props.popoverOverlayStyle}
|
|
431
|
-
overlayClassName={this.props.popoverOverlayClassName}
|
|
432
|
-
getPopupContainer={this.props.getPopupContainer}
|
|
433
430
|
/>
|
|
434
431
|
</div>
|
|
435
432
|
);
|
|
@@ -464,9 +461,6 @@ TagList.propTypes = {
|
|
|
464
461
|
// message to show when Add Label button is disabled (e.g. personalization restriction)
|
|
465
462
|
disableTooltipMsg: PropTypes.string,
|
|
466
463
|
restrictPersonalization: PropTypes.bool,
|
|
467
|
-
popoverOverlayStyle: PropTypes.object,
|
|
468
|
-
popoverOverlayClassName: PropTypes.string,
|
|
469
|
-
getPopupContainer: PropTypes.func,
|
|
470
464
|
intl: PropTypes.shape({
|
|
471
465
|
formatMessage: PropTypes.func.isRequired,
|
|
472
466
|
locale: PropTypes.string,
|
|
@@ -659,29 +659,11 @@
|
|
|
659
659
|
}
|
|
660
660
|
|
|
661
661
|
.action-container{
|
|
662
|
-
margin-top:
|
|
663
|
-
margin-bottom:
|
|
662
|
+
margin-top: 8px;
|
|
663
|
+
margin-bottom: 16px;
|
|
664
664
|
display: flex;
|
|
665
665
|
justify-content: space-between;
|
|
666
666
|
align-items: center;
|
|
667
|
-
|
|
668
|
-
&__toolbar-row {
|
|
669
|
-
display: flex;
|
|
670
|
-
align-items: center;
|
|
671
|
-
gap: 0.75rem;
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
&__toolbar-row .search-text {
|
|
675
|
-
width: 13.125rem;
|
|
676
|
-
min-width: 13.125rem;
|
|
677
|
-
flex: 1;
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
&__create-row {
|
|
681
|
-
display: flex;
|
|
682
|
-
justify-content: space-between;
|
|
683
|
-
align-items: center;
|
|
684
|
-
}
|
|
685
667
|
}
|
|
686
668
|
|
|
687
669
|
.popover-action-container:hover{
|
|
@@ -1119,47 +1101,4 @@
|
|
|
1119
1101
|
.inapp-illustration-parent {
|
|
1120
1102
|
height: "calc(100vh - 325px)";
|
|
1121
1103
|
overflow: 'auto';
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
/* Local SMS / slidebox: viewport-based .v2-pagination-container-half height leaves empty space below and clips cards */
|
|
1125
|
-
.creatives-templates-container--local-sms.library-mode {
|
|
1126
|
-
.creatives-templates-list.library-mode > .cap-row:first-of-type > div {
|
|
1127
|
-
display: flex;
|
|
1128
|
-
flex-direction: column;
|
|
1129
|
-
flex: 1 1 auto;
|
|
1130
|
-
min-height: 0;
|
|
1131
|
-
overflow: hidden;
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1134
|
-
.creatives-templates-list.library-mode > .cap-row:first-of-type > div > div:first-child {
|
|
1135
|
-
display: flex;
|
|
1136
|
-
flex-direction: column;
|
|
1137
|
-
flex: 1 1 auto;
|
|
1138
|
-
min-height: 0;
|
|
1139
|
-
overflow: hidden;
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
|
-
/* Block below search/filter: grid + skeletons — must grow to use space above footer */
|
|
1143
|
-
.creatives-templates-list.library-mode > .cap-row:first-of-type > div > div:first-child > div:nth-child(2) {
|
|
1144
|
-
flex: 1 1 auto;
|
|
1145
|
-
min-height: 0;
|
|
1146
|
-
display: flex;
|
|
1147
|
-
flex-direction: column;
|
|
1148
|
-
overflow: hidden;
|
|
1149
|
-
}
|
|
1150
|
-
|
|
1151
|
-
/*
|
|
1152
|
-
* Scroll needs a definite height. Pure flex + height:auto + max-height:100% often won’t bound (no % base), so no scrollbar.
|
|
1153
|
-
* Use a taller slice than global 100vh-20rem so the grid uses space under search; still overflow-y:auto for long lists.
|
|
1154
|
-
*/
|
|
1155
|
-
.v2-pagination-container,
|
|
1156
|
-
.v2-pagination-container-half {
|
|
1157
|
-
flex: 0 1 auto;
|
|
1158
|
-
min-height: 0;
|
|
1159
|
-
height: calc(100vh - 12rem);
|
|
1160
|
-
max-height: calc(100vh - 12rem);
|
|
1161
|
-
overflow-y: auto;
|
|
1162
|
-
overflow-x: hidden;
|
|
1163
|
-
-webkit-overflow-scrolling: touch;
|
|
1164
|
-
}
|
|
1165
1104
|
}
|
|
@@ -15,17 +15,6 @@ export function getAllTemplates(channel, queryParams, intlCopyOf = '') {
|
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
export function getLocalSmsTemplates(queryParams, intlCopyOf = '', onSuccess, onFailure) {
|
|
20
|
-
return {
|
|
21
|
-
type: types.GET_LOCAL_SMS_TEMPLATES_REQUEST,
|
|
22
|
-
queryParams,
|
|
23
|
-
intlCopyOf,
|
|
24
|
-
onSuccess,
|
|
25
|
-
onFailure,
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
18
|
export function resetTemplate() {
|
|
30
19
|
return {
|
|
31
20
|
type: types.RESET_TEMPLATE,
|
|
@@ -10,8 +10,6 @@ export const GET_ALL_TEMPLATES_REQUEST = 'app/v2Containers/Templates/GET_ALL_TEM
|
|
|
10
10
|
export const GET_ALL_TEMPLATES_SUCCESS = 'app/v2Containers/Templates/GET_ALL_TEMPLATES_SUCCESS';
|
|
11
11
|
export const GET_ALL_TEMPLATES_FAILURE = 'app/v2Containers/Templates/GET_ALL_TEMPLATES_FAILURE';
|
|
12
12
|
|
|
13
|
-
export const GET_LOCAL_SMS_TEMPLATES_REQUEST = 'app/v2Containers/Templates/GET_LOCAL_SMS_TEMPLATES_REQUEST';
|
|
14
|
-
|
|
15
13
|
export const DELETE_TEMPLATE_REQUEST = 'app/v2Containers/Templates/DELETE_TEMPLATE_REQUEST';
|
|
16
14
|
export const DELETE_RCS_TEMPLATE_REQUEST = 'app/v2Containers/Templates/DELETE_RCS_TEMPLATE_REQUEST';
|
|
17
15
|
export const DELETE_TEMPLATE_SUCCESS = 'app/v2Containers/Templates/DELETE_TEMPLATE_SUCCESS';
|
|
@@ -468,13 +468,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
468
468
|
if (this.props.location.query.type === 'embedded') {
|
|
469
469
|
this.props.actions.resetAccount();
|
|
470
470
|
}
|
|
471
|
-
|
|
472
|
-
const useLocalTemplates = get(
|
|
473
|
-
this.props,
|
|
474
|
-
'localTemplatesConfig.useLocalTemplates',
|
|
475
|
-
get(this.props, 'useLocalTemplates', false),
|
|
476
|
-
);
|
|
477
|
-
if (!useLocalTemplates && ['line', VIBER_CHANNEL, FACEBOOK_CHANNEL, 'sms', 'email', 'ebill'].includes((this.state.channel || '').toLowerCase())) {
|
|
471
|
+
if (['line', VIBER_CHANNEL, FACEBOOK_CHANNEL, 'sms', 'email', 'ebill'].includes((this.state.channel || '').toLowerCase())) {
|
|
478
472
|
const queryParams = {
|
|
479
473
|
// name: this.state.searchText,
|
|
480
474
|
// sortBy: this.state.sortBy,
|
|
@@ -987,16 +981,8 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
987
981
|
|
|
988
982
|
componentWillUnmount() {
|
|
989
983
|
window.removeEventListener("message", this.handleFrameTasks);
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
this.props,
|
|
993
|
-
'localTemplatesConfig.useLocalTemplates',
|
|
994
|
-
get(this.props, 'useLocalTemplates', false),
|
|
995
|
-
);
|
|
996
|
-
if (!useLocalTemplates) {
|
|
997
|
-
this.props.actions.resetTemplateStoreData();
|
|
998
|
-
this.props.globalActions.clearMetaEntities();
|
|
999
|
-
}
|
|
984
|
+
this.props.actions.resetTemplateStoreData();
|
|
985
|
+
this.props.globalActions.clearMetaEntities();
|
|
1000
986
|
// Clear any pending timeouts to prevent memory leaks
|
|
1001
987
|
if (this._clearEditTimeout) {
|
|
1002
988
|
clearTimeout(this._clearEditTimeout);
|
|
@@ -1961,7 +1947,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1961
1947
|
style={{ marginRight: "16px" }}
|
|
1962
1948
|
type="eye"
|
|
1963
1949
|
onClick={() => {
|
|
1964
|
-
if (!this.props.isFullMode || this.props.isDltFromRcs
|
|
1950
|
+
if (!this.props.isFullMode || this.props.isDltFromRcs) {
|
|
1965
1951
|
if (!get(template, "versions.base.content.zalo.previewUrl", "")) {
|
|
1966
1952
|
this.setState({ zaloPreviewItemId: template?._id });
|
|
1967
1953
|
}
|
|
@@ -3296,13 +3282,6 @@ return (<div>
|
|
|
3296
3282
|
this.setState({modeType});
|
|
3297
3283
|
}
|
|
3298
3284
|
const { _id: id } = template;
|
|
3299
|
-
const {
|
|
3300
|
-
localTemplatesConfig,
|
|
3301
|
-
fbAdManager,
|
|
3302
|
-
isDltFromRcs,
|
|
3303
|
-
isSmsFallbackFromRcs,
|
|
3304
|
-
onSelectTemplate,
|
|
3305
|
-
} = this.props;
|
|
3306
3285
|
const type = this.props.location.query.type;
|
|
3307
3286
|
const module = this.props.location.query.module;
|
|
3308
3287
|
const isLanguageSupport = (this.props.location.query.isLanguageSupport) ? this.props.location.query.isLanguageSupport : false;
|
|
@@ -3388,12 +3367,10 @@ return (<div>
|
|
|
3388
3367
|
}
|
|
3389
3368
|
if (this.isEnabledInLibraryModule("callSelectFromProps")) {
|
|
3390
3369
|
let data = id;
|
|
3391
|
-
if (
|
|
3392
|
-
data = template;
|
|
3393
|
-
} else if (fbAdManager || isDltFromRcs || isSmsFallbackFromRcs) {
|
|
3370
|
+
if (this.props.fbAdManager || this.props.isDltFromRcs) {
|
|
3394
3371
|
data = this.selectTemplate(id);
|
|
3395
3372
|
}
|
|
3396
|
-
onSelectTemplate(data, fbAdManager);
|
|
3373
|
+
this.props.onSelectTemplate(data, this.props.fbAdManager);
|
|
3397
3374
|
} else {
|
|
3398
3375
|
timeTracker.startTimer(CHANNEL_EDIT_TRACK_MAPPING[this.state.channel.toLowerCase()]);
|
|
3399
3376
|
if (this.state.channel.toLowerCase() === 'ebill') {
|
|
@@ -4237,23 +4214,17 @@ return (<div>
|
|
|
4237
4214
|
if (([WHATSAPP_LOWERCASE, ZALO_LOWERCASE, RCS_LOWERCASE].includes(this.state?.channel?.toLocaleLowerCase()) && isEmpty(this.state?.hostName))) {
|
|
4238
4215
|
isfilterContentVisisble = false;
|
|
4239
4216
|
}
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
onSearch={() => this.searchTemplate(this.state.searchText, this.state.channel)}
|
|
4252
|
-
onClear={() => this.searchTemplate('', this.state.channel)}
|
|
4253
|
-
onScroll={(e) => e.stopPropagation()}
|
|
4254
|
-
disabled={this.checkSearchDisabled()}
|
|
4255
|
-
/>
|
|
4256
|
-
) : null}
|
|
4217
|
+
const filterContent = (( isfilterContentVisisble || [WECHAT, MOBILE_PUSH, INAPP].includes(this.state.channel.toUpperCase())) && <div className="action-container">
|
|
4218
|
+
{isfilterContentVisisble && <CapInput.Search
|
|
4219
|
+
className="search-text"
|
|
4220
|
+
style={{width: '210px'}}
|
|
4221
|
+
placeholder={this.props.intl.formatMessage(messages.searchText)}
|
|
4222
|
+
value={this.state.searchText}
|
|
4223
|
+
onChange={(e) => this.searchTemplate(e.target.value, this.state.channel)}
|
|
4224
|
+
disabled={this.checkSearchDisabled()}
|
|
4225
|
+
onClear={() => this.searchTemplate('', this.state.channel)}
|
|
4226
|
+
onScroll={(e) => e.stopPropagation()}
|
|
4227
|
+
/>}
|
|
4257
4228
|
{
|
|
4258
4229
|
channel.toUpperCase() === WECHAT && <CapRadio.CapRadioGroup className="wechat-filters" defaultValue={wechatFilter} onChange={this.setWechatFilter}>
|
|
4259
4230
|
<CapRadio.Button value={WECHAT_FILTERS.ALL}><CapLabel type="label2">
|
|
@@ -4399,27 +4370,20 @@ return (<div>
|
|
|
4399
4370
|
</div>
|
|
4400
4371
|
)
|
|
4401
4372
|
}
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
{
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
: isfilterContentVisisble && !isWechatEmbedded && !this.props.isDltFromRcs && !this.props.isSmsFallbackFromRcs && createButton
|
|
4414
|
-
}
|
|
4415
|
-
</div>
|
|
4416
|
-
</div>
|
|
4373
|
+
<div style={{display: "flex", justifyContent: "space-between", alignItems: 'center'}}>
|
|
4374
|
+
{
|
|
4375
|
+
this.state?.channel?.toLowerCase() === WHATSAPP_LOWERCASE && (isWhatsappCountExeeded)? (
|
|
4376
|
+
<CapTooltip title={whatsappCountExceedText}>
|
|
4377
|
+
<div className="button-disabled-tooltip-wrapper">
|
|
4378
|
+
{createButton}
|
|
4379
|
+
</div>
|
|
4380
|
+
</CapTooltip>
|
|
4381
|
+
)
|
|
4382
|
+
: isfilterContentVisisble && !isWechatEmbedded && !this.props.isDltFromRcs && createButton
|
|
4383
|
+
}
|
|
4417
4384
|
</div>
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
const filterContent = (useLocalTemplates && localTemplatesFilterContent) != null
|
|
4421
|
-
? localTemplatesFilterContent
|
|
4422
|
-
: builtFilterContent;
|
|
4385
|
+
|
|
4386
|
+
</div>);
|
|
4423
4387
|
let htmlPreviewContent = "";
|
|
4424
4388
|
if (this.state.channel.toLowerCase() === 'ebill') {
|
|
4425
4389
|
htmlPreviewContent = this.state.previewTemplate && this.state.previewTemplate.versions && this.state.previewTemplate.versions.base && this.state.previewTemplate.versions.base['ebill-editor'];
|
|
@@ -4429,10 +4393,7 @@ return (<div>
|
|
|
4429
4393
|
|
|
4430
4394
|
|
|
4431
4395
|
const creativesParams = this.getCreativesParams();
|
|
4432
|
-
const templates =
|
|
4433
|
-
? (this.props.localTemplatesConfig?.localTemplates || [])
|
|
4434
|
-
: (this.props.TemplatesList || []);
|
|
4435
|
-
const isLoadingWhenLocal = useLocalTemplates && !!this.props.localTemplatesConfig?.localTemplatesLoading;
|
|
4396
|
+
const templates = this.props.TemplatesList || [];
|
|
4436
4397
|
const {route} = this.props;
|
|
4437
4398
|
const loadingTipMap = {
|
|
4438
4399
|
sendingFile: 'uploadingFile',
|
|
@@ -4447,11 +4408,9 @@ return (<div>
|
|
|
4447
4408
|
(deleteRcsTemplateInProgress && 'deletingTemplate') ||
|
|
4448
4409
|
(this.props.EmailCreate.duplicateTemplateInProgress && 'duplicatingTemplate');
|
|
4449
4410
|
|
|
4450
|
-
const loadingTip =
|
|
4451
|
-
? this.props.localTemplatesConfig.localTemplatesLoadingTip
|
|
4452
|
-
: (messages[loadingTipIntl] ? this.props.intl.formatMessage(messages[loadingTipIntl]) : this.props.intl.formatMessage(messages.gettingAllTemplates));
|
|
4411
|
+
const loadingTip = messages[loadingTipIntl] ? this.props.intl.formatMessage(messages[loadingTipIntl]) : this.props.intl.formatMessage(messages.gettingAllTemplates);
|
|
4453
4412
|
const showNoTemplatesFoundZalo = this.state.channel.toUpperCase() === ZALO && isEmpty(this.state.searchedZaloTemplates) && this.state.searchingZaloTemplate;
|
|
4454
|
-
const showNoTemplatesFoundOther = ![ZALO].includes(this.state.channel.toUpperCase()) && isEmpty(
|
|
4413
|
+
const showNoTemplatesFoundOther = ![ZALO].includes(this.state.channel.toUpperCase()) && isEmpty(this.props.TemplatesList) && !this.props.Templates.getAllTemplatesInProgress && !isEmpty(this.state.searchText);
|
|
4455
4414
|
const showNoTemplatesFound = showNoTemplatesFoundZalo || showNoTemplatesFoundOther;
|
|
4456
4415
|
|
|
4457
4416
|
return (
|
|
@@ -4496,22 +4455,22 @@ return (<div>
|
|
|
4496
4455
|
) : null}
|
|
4497
4456
|
<CapRow>
|
|
4498
4457
|
<Pagination
|
|
4499
|
-
templateInProgress={
|
|
4458
|
+
templateInProgress={
|
|
4459
|
+
this.props.Templates.getAllTemplatesInProgress
|
|
4460
|
+
}
|
|
4500
4461
|
onPageChange={
|
|
4501
|
-
templates.length
|
|
4502
|
-
? (useLocalTemplates ? (this.props.localTemplatesConfig?.localTemplatesOnPageChange || (() => {})) : this.onPaginationChange)
|
|
4503
|
-
: () => {}
|
|
4462
|
+
templates.length ? this.onPaginationChange : () => {}
|
|
4504
4463
|
}
|
|
4505
4464
|
>
|
|
4506
4465
|
{this.getTemplateDataForGrid({
|
|
4507
4466
|
previewTemplateId: this.state.zaloPreviewItemId,
|
|
4508
|
-
isLoading
|
|
4509
|
-
isInitialLoading
|
|
4467
|
+
isLoading,
|
|
4468
|
+
isInitialLoading,
|
|
4510
4469
|
loadingTip,
|
|
4511
4470
|
channel: this.state.channel,
|
|
4512
4471
|
templates: this.state.searchingZaloTemplate
|
|
4513
4472
|
? this.state.searchedZaloTemplates
|
|
4514
|
-
:
|
|
4473
|
+
: this.props.TemplatesList,
|
|
4515
4474
|
filterContent,
|
|
4516
4475
|
handlers: {
|
|
4517
4476
|
handlePreviewClick: this.handlePreviewClick,
|
|
@@ -4694,15 +4653,6 @@ Templates.propTypes = {
|
|
|
4694
4653
|
WebPush: PropTypes.object,
|
|
4695
4654
|
smsRegister: PropTypes.any,
|
|
4696
4655
|
isDltFromRcs: PropTypes.bool,
|
|
4697
|
-
isSmsFallbackFromRcs: PropTypes.bool,
|
|
4698
|
-
localTemplatesConfig: PropTypes.shape({
|
|
4699
|
-
useLocalTemplates: PropTypes.bool,
|
|
4700
|
-
localTemplates: PropTypes.arrayOf(PropTypes.object),
|
|
4701
|
-
localTemplatesLoading: PropTypes.bool,
|
|
4702
|
-
localTemplatesLoadingTip: PropTypes.string,
|
|
4703
|
-
localTemplatesFilterContent: PropTypes.node,
|
|
4704
|
-
localTemplatesOnPageChange: PropTypes.func,
|
|
4705
|
-
}),
|
|
4706
4656
|
};
|
|
4707
4657
|
|
|
4708
4658
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
call, put, takeLatest,
|
|
2
|
+
call, put, takeLatest, all,
|
|
3
3
|
} from 'redux-saga/effects';
|
|
4
4
|
import get from 'lodash/get';
|
|
5
5
|
// import { schema, normalize } from 'normalizr';
|
|
@@ -7,69 +7,31 @@ import * as Api from '../../services/api';
|
|
|
7
7
|
import * as types from './constants';
|
|
8
8
|
import { saveCdnConfigs, removeAllCdnLocalStorageItems } from '../../utils/cdnTransformation';
|
|
9
9
|
import { COPY_OF } from '../../constants/unified';
|
|
10
|
-
import { fetchSmsTemplatesFromQuery } from './utils/smsTemplatesListApi';
|
|
11
10
|
import { ZALO_TEMPLATE_INFO_REQUEST } from '../Zalo/constants';
|
|
12
11
|
import { getTemplateInfoById } from '../Zalo/saga';
|
|
13
|
-
|
|
14
|
-
export function*
|
|
15
|
-
try {
|
|
16
|
-
const fetched = yield call(
|
|
17
|
-
fetchSmsTemplatesFromQuery,
|
|
18
|
-
action.queryParams,
|
|
19
|
-
action.intlCopyOf,
|
|
20
|
-
);
|
|
21
|
-
if (typeof action.onSuccess === 'function') {
|
|
22
|
-
yield call(action.onSuccess, fetched);
|
|
23
|
-
}
|
|
24
|
-
} catch (error) {
|
|
25
|
-
if (typeof action.onFailure === 'function') {
|
|
26
|
-
yield call(action.onFailure, error);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function* getAllTemplates(action) {
|
|
12
|
+
// Individual exports for testing
|
|
13
|
+
export function* getAllTemplates(channel, queryParams) {
|
|
32
14
|
try {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
action.intlCopyOf,
|
|
38
|
-
);
|
|
39
|
-
yield put({
|
|
40
|
-
type: types.GET_ALL_TEMPLATES_SUCCESS,
|
|
41
|
-
data: fetched.channelTemplates,
|
|
42
|
-
weCRMTemplate: fetched.weCRMTemplate,
|
|
43
|
-
isReset: get(action, 'queryParams.page') === 1,
|
|
44
|
-
});
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const result = yield call(Api.getAllTemplates, action);
|
|
49
|
-
const channelTemplates = (action.channel === 'wechat')
|
|
50
|
-
? { templates: [...result.response.mapped, ...result.response.richmedia] }
|
|
51
|
-
: result.response;
|
|
52
|
-
if (action.channel === 'wechat' && action.queryParams && action.queryParams.sortBy && action.queryParams.sortBy.toLocaleLowerCase() === ("Most Recent").toLocaleLowerCase()) {
|
|
15
|
+
const result = yield call(Api.getAllTemplates, channel, queryParams);
|
|
16
|
+
const channelTemplates = (channel.channel === 'wechat') ? { templates: [...result.response.mapped, ...result.response.richmedia] } : result.response;
|
|
17
|
+
// const sidebar = result.response.sidebar;
|
|
18
|
+
if (channel.channel === 'wechat' && channel.queryParams && channel.queryParams.sortBy && channel.queryParams.sortBy.toLocaleLowerCase() === ("Most Recent").toLocaleLowerCase()) {
|
|
53
19
|
channelTemplates.templates.sort((a, b) => {
|
|
54
20
|
const dateA = new Date(a.updatedAt);
|
|
55
21
|
const dateB = new Date(b.updatedAt);
|
|
56
22
|
return dateB - dateA;
|
|
57
23
|
});
|
|
58
|
-
} else if (
|
|
24
|
+
} else if (channel.channel === 'wechat' && channel.queryParams && channel.queryParams.sortBy && channel.queryParams.sortBy.toLocaleLowerCase() === ("Alphabetically").toLocaleLowerCase()) {
|
|
59
25
|
channelTemplates.templates.sort((a, b) => b.name - a.name);
|
|
60
26
|
}
|
|
61
|
-
|
|
27
|
+
// Update the "name" property in each template
|
|
28
|
+
if (channel.intlCopyOf && channelTemplates?.templates) {
|
|
62
29
|
channelTemplates.templates = channelTemplates.templates.map((template) => ({
|
|
63
30
|
...template,
|
|
64
|
-
name: template.name.replace(new RegExp(COPY_OF, 'g'),
|
|
31
|
+
name: template.name.replace(new RegExp(COPY_OF, 'g'), channel.intlCopyOf),
|
|
65
32
|
}));
|
|
66
33
|
}
|
|
67
|
-
yield put({
|
|
68
|
-
type: types.GET_ALL_TEMPLATES_SUCCESS,
|
|
69
|
-
data: channelTemplates,
|
|
70
|
-
weCRMTemplate: result.response.unMapped,
|
|
71
|
-
isReset: get(action, 'queryParams.page') === 1,
|
|
72
|
-
});
|
|
34
|
+
yield put({ type: types.GET_ALL_TEMPLATES_SUCCESS, data: channelTemplates, weCRMTemplate: result.response.unMapped, isReset: channel.queryParams.page === 1 });
|
|
73
35
|
} catch (error) {
|
|
74
36
|
yield put({ type: types.GET_ALL_TEMPLATES_FAILURE, error });
|
|
75
37
|
}
|
|
@@ -243,11 +205,6 @@ export function* watchGetAllTemplates() {
|
|
|
243
205
|
yield takeLatest(types.GET_ALL_TEMPLATES_REQUEST, getAllTemplates);
|
|
244
206
|
}
|
|
245
207
|
|
|
246
|
-
|
|
247
|
-
export function* watchGetLocalSmsTemplates() {
|
|
248
|
-
yield takeEvery(types.GET_LOCAL_SMS_TEMPLATES_REQUEST, getLocalSmsTemplates);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
208
|
export function* watchDeleteTemplate() {
|
|
252
209
|
yield takeLatest(types.DELETE_TEMPLATE_REQUEST, deleteTemplate);
|
|
253
210
|
}
|
|
@@ -301,7 +258,6 @@ export function* watchForGetTemplateInfoById() {
|
|
|
301
258
|
// All sagas to be loaded
|
|
302
259
|
export default [
|
|
303
260
|
watchGetAllTemplates,
|
|
304
|
-
watchGetLocalSmsTemplates,
|
|
305
261
|
watchDeleteTemplate,
|
|
306
262
|
watchDeleteRcsTemplate,
|
|
307
263
|
watchGetUserList,
|
|
@@ -318,7 +274,6 @@ export default [
|
|
|
318
274
|
export function* v2TemplateSaga() {
|
|
319
275
|
yield all([
|
|
320
276
|
watchGetAllTemplates(),
|
|
321
|
-
watchGetLocalSmsTemplates(),
|
|
322
277
|
watchDeleteTemplate(),
|
|
323
278
|
watchDeleteRcsTemplate(),
|
|
324
279
|
watchGetUserList(),
|