@capillarytech/creatives-library 8.0.97 → 8.0.98
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.
|
@@ -43,3 +43,9 @@ export const RESET_TEMPLATE = "app/containers/Templates/RESET_TEMPLATE";
|
|
|
43
43
|
export const RESET_TEMPLATE_DATA = "app/containers/Templates/RESET_TEMPLATE_DATA";
|
|
44
44
|
export const RESET_UPLOAD_DATA = "app/containers/Templates/RESET_UPLOAD_DATA";
|
|
45
45
|
export const CLEAR_TEMPLATE_STORE_DATA = "app/containers/Templates/CLEAR_TEMPLATE_STORE_DATA";
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
export const TRUE = 'true';
|
|
49
|
+
export const FALSE = 'false';
|
|
50
|
+
export const EMAIL = 'email';
|
|
51
|
+
export const TYPE_EMBEDDED = 'embedded';
|
|
@@ -57,6 +57,8 @@ import lineCreateReducer from '../Line/Create/reducer';
|
|
|
57
57
|
import { ebillSaga } from '../Ebill/sagas';
|
|
58
58
|
import { lineCreateSaga } from '../Line/Create/sagas';
|
|
59
59
|
import { duplicateMPushSaga } from '../MobilePush/Create/sagas';
|
|
60
|
+
import { FALSE, TRUE, TYPE_EMBEDDED } from './constants';
|
|
61
|
+
import { DEFAULT } from '../../v2Containers/Cap/constants';
|
|
60
62
|
|
|
61
63
|
const MenuItem = Menu.Item;
|
|
62
64
|
const Option = Select.Option;
|
|
@@ -914,31 +916,49 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
914
916
|
|
|
915
917
|
handleEdmDefaultTemplateSelection = (isSelected, id) => {
|
|
916
918
|
if (isSelected) {
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
const
|
|
921
|
-
|
|
919
|
+
const template = _.find(this.props?.Templates?.cmsTemplates, (template = []) => {
|
|
920
|
+
return template?.versions && template?.versions?.base && _.get(template, 'versions.base.drag_drop_id') === id;
|
|
921
|
+
});
|
|
922
|
+
const {type,module = DEFAULT} = this.props?.location?.query;
|
|
923
|
+
const isLanguageSupport = this.props?.location?.query?.isLanguageSupport === TRUE;
|
|
924
|
+
const isEdmSupport = this.props?.location?.query?.isEdmSupport !== FALSE;
|
|
922
925
|
let getQuery = '';
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
926
|
+
|
|
927
|
+
if (template) {
|
|
928
|
+
this.props.actions.setEdmTemplate({
|
|
929
|
+
...template,
|
|
930
|
+
isEdmSupport,
|
|
931
|
+
isLanguageSupport,
|
|
932
|
+
projectId: template?.versions?.base?.drag_drop_id,
|
|
933
|
+
});
|
|
934
|
+
|
|
935
|
+
if (this.state.channel && this.state.channel.toLowerCase() === EMAIL) {
|
|
936
|
+
getQuery = (type === TYPE_EMBEDDED) ? {
|
|
937
|
+
type: TYPE_EMBEDDED,
|
|
938
|
+
module,
|
|
939
|
+
isLanguageSupport: isLanguageSupport ? 1 : 0,
|
|
940
|
+
isEdmSupport: isEdmSupport ? 1 : 0,
|
|
941
|
+
projectId: template?.versions?.base?.drag_drop_id,
|
|
942
|
+
} : {
|
|
943
|
+
module,
|
|
944
|
+
isLanguageSupport: isLanguageSupport ? 1 : 0,
|
|
945
|
+
isEdmSupport: isEdmSupport ? 1 : 0,
|
|
946
|
+
projectId: template?.versions?.base?.drag_drop_id,
|
|
947
|
+
};
|
|
948
|
+
} else {
|
|
949
|
+
getQuery = (type === TYPE_EMBEDDED) ? {type: TYPE_EMBEDDED, module} : {module};
|
|
950
|
+
}
|
|
934
951
|
|
|
935
|
-
|
|
936
|
-
|
|
952
|
+
if (this.isEnabledInLibraryModule("callCreateFromProps")) {
|
|
953
|
+
this.props.createNew();
|
|
954
|
+
return;
|
|
955
|
+
}
|
|
937
956
|
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
957
|
+
this.props.router.push({
|
|
958
|
+
pathname: `/${this.state.channel.toLowerCase()}/create`,
|
|
959
|
+
search: commonUtil.createQueryString(getQuery),
|
|
960
|
+
});
|
|
961
|
+
}
|
|
942
962
|
}
|
|
943
963
|
};
|
|
944
964
|
|
|
@@ -1128,7 +1148,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1128
1148
|
const imgSrc = template && template.versions && template.versions.base ? template.versions.base.preview_http_url : '';
|
|
1129
1149
|
const ifPreviewGenerated = template && template.versions && template.versions.base ? template.versions.base.isPreviewGenerated : 0;
|
|
1130
1150
|
content = <img src={imgSrc || ''} alt={this.props.intl.formatMessage(messages.previewGenerateText)} width="100%" height="100%"/>;
|
|
1131
|
-
|
|
1151
|
+
|
|
1132
1152
|
temp.content = (
|
|
1133
1153
|
<div
|
|
1134
1154
|
className="sms-template-content">
|
|
@@ -1136,7 +1156,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1136
1156
|
{content}
|
|
1137
1157
|
</div>
|
|
1138
1158
|
{!layoutSelection && template._id === this.state.hoveredItem ? <CapButton onClick={(e) => this.handleEditClick(e, template._id)} className="edit-button" type="secondary">{type === 'embedded' ? this.props.intl.formatMessage(messages.selectButton) : this.props.intl.formatMessage(messages.editButton)}</CapButton> : ''}
|
|
1139
|
-
{layoutSelection && template._id === this.state.hoveredItem ? <CapButton onClick={(event) =>{this.handleEdmDefaultTemplateSelection(true, template
|
|
1159
|
+
{layoutSelection && template._id === this.state.hoveredItem ? <CapButton onClick={(event) =>{this.handleEdmDefaultTemplateSelection(true, template?.versions?.base?.drag_drop_id); event.stopPropagation();}} className="select-button" type="secondary">{type === 'embedded' ? this.props.intl.formatMessage(messages.selectDefaultButton) : this.props.intl.formatMessage(messages.selectDefaultButton)}</CapButton> : ''}
|
|
1140
1160
|
{!layoutSelection && template._id === this.state.hoveredItem ? <CapButton onClick={() => this.handlePreviewClick(template)} className="preview-button" type="cancel">{this.props.intl.formatMessage(messages.previewButton)}</CapButton> : ''}
|
|
1141
1161
|
</div>);
|
|
1142
1162
|
} else if (this.state.channel.toLowerCase() === 'mobilepush') {
|