@capillarytech/creatives-library 2.0.48 → 2.0.49
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/containers/CreativesContainer/SlideBoxContent.js +6 -0
- package/containers/CreativesContainer/index.js +20 -4
- package/containers/Email/index.js +7 -0
- package/containers/EmailWrapper/index.js +3 -1
- package/containers/Sms/Create/index.js +7 -0
- package/containers/Sms/Edit/index.js +7 -0
- package/package.json +1 -1
|
@@ -36,6 +36,7 @@ function SlideBoxContent(props) {
|
|
|
36
36
|
cap,
|
|
37
37
|
onResetStep,
|
|
38
38
|
isFullMode,
|
|
39
|
+
setIsLoadingContent,
|
|
39
40
|
} = props;
|
|
40
41
|
const type = messageDetails.type.toLowerCase(); // type is context in get tags values : outbound | dvs | referral | loyalty | coupons
|
|
41
42
|
const query = { type: !isFullMode && 'embedded', module: isFullMode ? 'defualt' : 'library', isLanguageSupport: true};
|
|
@@ -91,6 +92,7 @@ function SlideBoxContent(props) {
|
|
|
91
92
|
}
|
|
92
93
|
{isEditSms && (
|
|
93
94
|
<SmsEdit
|
|
95
|
+
setIsLoadingContent={setIsLoadingContent}
|
|
94
96
|
location={creativesLocationProps}
|
|
95
97
|
isFullMode={isFullMode}
|
|
96
98
|
route={{ name: 'sms' }}
|
|
@@ -103,6 +105,7 @@ function SlideBoxContent(props) {
|
|
|
103
105
|
)}
|
|
104
106
|
{isCreateSms && (
|
|
105
107
|
<SmsCreate
|
|
108
|
+
setIsLoadingContent={setIsLoadingContent}
|
|
106
109
|
location={creativesLocationProps}
|
|
107
110
|
route={{ name: 'sms' }}
|
|
108
111
|
isComponent
|
|
@@ -114,6 +117,7 @@ function SlideBoxContent(props) {
|
|
|
114
117
|
)}
|
|
115
118
|
{isEmailCreate && (
|
|
116
119
|
<EmailWrapper
|
|
120
|
+
setIsLoadingContent={setIsLoadingContent}
|
|
117
121
|
onEmailModeChange={onEmailModeChange}
|
|
118
122
|
emailCreateMode={emailCreateMode}
|
|
119
123
|
isGetFormData={isGetFormData}
|
|
@@ -129,6 +133,7 @@ function SlideBoxContent(props) {
|
|
|
129
133
|
)}
|
|
130
134
|
{(isEditEmailWithId || isEmailEditWithContent) && (
|
|
131
135
|
<Email
|
|
136
|
+
setIsLoadingContent={setIsLoadingContent}
|
|
132
137
|
location={{
|
|
133
138
|
pathname: `/email`,
|
|
134
139
|
query,
|
|
@@ -166,5 +171,6 @@ SlideBoxContent.propTypes = {
|
|
|
166
171
|
cap: PropTypes.object,
|
|
167
172
|
onResetStep: PropTypes.func,
|
|
168
173
|
isFullMode: PropTypes.bool,
|
|
174
|
+
setIsLoadingContent: PropTypes.func,
|
|
169
175
|
};
|
|
170
176
|
export default SlideBoxContent;
|
|
@@ -27,6 +27,7 @@ class Creatives extends React.Component {
|
|
|
27
27
|
constructor(props) {
|
|
28
28
|
super(props);
|
|
29
29
|
this.state = {
|
|
30
|
+
isLoadingContent: true,
|
|
30
31
|
templateStep: 1, //modeSelection: for template name and (for email selecting upload or editor), and createTemplate to create template create based on modeSelection
|
|
31
32
|
showSlideBox: true,
|
|
32
33
|
slidBoxContent: this.getSlideBocContent({mode: props.creativesMode, templateData: props.templateData, isFullMode: props.isFullMode}),
|
|
@@ -152,6 +153,11 @@ class Creatives extends React.Component {
|
|
|
152
153
|
);
|
|
153
154
|
}
|
|
154
155
|
};
|
|
156
|
+
setIsLoadingContent = (isLoadingContent) => {
|
|
157
|
+
if (this.state.isLoadingContent !== isLoadingContent) {
|
|
158
|
+
this.setState({isLoadingContent });
|
|
159
|
+
}
|
|
160
|
+
}
|
|
155
161
|
resetStep = () => {
|
|
156
162
|
this.setState((prevState) => {
|
|
157
163
|
let newState = {
|
|
@@ -176,18 +182,27 @@ class Creatives extends React.Component {
|
|
|
176
182
|
shouldShowFooter = () => {
|
|
177
183
|
const {isFullMode} = this.props;
|
|
178
184
|
const {slidBoxContent, currentChannel, emailCreateMode, templateStep} = this.state;
|
|
185
|
+
const channel = currentChannel.toUpperCase();
|
|
186
|
+
const currentStep = this.creativesTemplateSteps[templateStep];
|
|
179
187
|
let showFooter = false;
|
|
180
188
|
if (!isFullMode ) {
|
|
181
|
-
const isEmailCreate = slidBoxContent === 'createTemplate' &&
|
|
189
|
+
const isEmailCreate = slidBoxContent === 'createTemplate' && channel === constants.EMAIL && currentStep !== 'createTemplateContent';
|
|
182
190
|
const isCreate = (slidBoxContent === 'editTemplate' || slidBoxContent === 'createTemplate') && !isEmailCreate;
|
|
183
191
|
showFooter = (isCreate || (isEmailCreate && emailCreateMode) || slidBoxContent === 'preview');
|
|
184
|
-
} else if (
|
|
185
|
-
const isEmailCreate = slidBoxContent === 'createTemplate' &&
|
|
192
|
+
} else if (channel === constants.EMAIL && isFullMode) {
|
|
193
|
+
const isEmailCreate = slidBoxContent === 'createTemplate' && channel === constants.EMAIL && currentStep !== 'createTemplateContent';
|
|
186
194
|
showFooter = isEmailCreate && emailCreateMode;
|
|
187
195
|
}
|
|
188
|
-
if (
|
|
196
|
+
if (channel === constants.EMAIL && emailCreateMode === "upload") {
|
|
189
197
|
showFooter = showFooter && !this.props.isUploading;
|
|
190
198
|
}
|
|
199
|
+
if (showFooter) {
|
|
200
|
+
if (slidBoxContent === "createTemplate" && ((channel === constants.EMAIL && currentStep === 'createTemplateContent') || (channel === constants.SMS && currentStep === 'modeSelection'))) {
|
|
201
|
+
showFooter = showFooter && !this.state.isLoadingContent;
|
|
202
|
+
} else if (slidBoxContent === "editTemplate" && ((channel === constants.EMAIL && currentStep === 'modeSelection') || (channel === constants.SMS && currentStep === 'modeSelection'))) {
|
|
203
|
+
showFooter = showFooter && !this.state.isLoadingContent;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
191
206
|
return showFooter;
|
|
192
207
|
}
|
|
193
208
|
shouldShowDoneFooter = () => {
|
|
@@ -244,6 +259,7 @@ class Creatives extends React.Component {
|
|
|
244
259
|
onEmailNextStep={this.onEmailNextStep}
|
|
245
260
|
onResetStep={this.resetStep}
|
|
246
261
|
cap={cap}
|
|
262
|
+
setIsLoadingContent={this.setIsLoadingContent}
|
|
247
263
|
/>
|
|
248
264
|
}
|
|
249
265
|
footer={this.shouldShowFooter() &&
|
|
@@ -504,6 +504,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
504
504
|
}
|
|
505
505
|
|
|
506
506
|
componentWillUnmount() {
|
|
507
|
+
if (this.props.setIsLoadingContent) {
|
|
508
|
+
this.props.setIsLoadingContent(true); // setting isLoading of CreativesContainer so that slidebox foot can be hidden till content is loaded
|
|
509
|
+
}
|
|
507
510
|
this.resetStateValue();
|
|
508
511
|
window.removeEventListener("message", this.handleFrameTasks);
|
|
509
512
|
this.props.actions.clearStoreValues();
|
|
@@ -2448,6 +2451,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2448
2451
|
// if (isLoading) {
|
|
2449
2452
|
// this.props.creativesContainerActions.hideCreativesContanerLoader();
|
|
2450
2453
|
// }
|
|
2454
|
+
if (!isLoading && this.props.setIsLoadingContent) {
|
|
2455
|
+
this.props.setIsLoadingContent(isLoading);
|
|
2456
|
+
}
|
|
2451
2457
|
return isLoading;
|
|
2452
2458
|
}
|
|
2453
2459
|
renderConfirmationModal() {
|
|
@@ -2640,6 +2646,7 @@ Email.propTypes = {
|
|
|
2640
2646
|
isLoadingMetaEntities: PropTypes.bool,
|
|
2641
2647
|
// creativesContainerActions: PropTypes.object,
|
|
2642
2648
|
isFullMode: PropTypes.bool,
|
|
2649
|
+
setIsLoadingContent: PropTypes.func,
|
|
2643
2650
|
};
|
|
2644
2651
|
|
|
2645
2652
|
const mapStateToProps = (state, props) => createStructuredSelector({
|
|
@@ -143,7 +143,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
143
143
|
|
|
144
144
|
isShowEmailCreate = () => !_.isEmpty(this.state.selectedCreateMode) && (!_.isEmpty(this.props.EmailLayout) || this.props.SelectedEdmDefaultTemplate)
|
|
145
145
|
render() {
|
|
146
|
-
const {emailCreateMode, isGetFormData, getFormdata, type, CmsTemplates, step, cap, isFullMode, EmailLayout} = this.props;
|
|
146
|
+
const {emailCreateMode, isGetFormData, getFormdata, type, CmsTemplates, step, cap, isFullMode, EmailLayout, setIsLoadingContent} = this.props;
|
|
147
147
|
const {templateName, modeContent} = this.state;
|
|
148
148
|
const isShowEmailCreate = this.isShowEmailCreate();
|
|
149
149
|
return (
|
|
@@ -180,6 +180,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
180
180
|
:
|
|
181
181
|
<div>
|
|
182
182
|
{isShowEmailCreate && <Email
|
|
183
|
+
setIsLoadingContent={setIsLoadingContent}
|
|
183
184
|
key="email-create-template"
|
|
184
185
|
location={this.state.routeParams}
|
|
185
186
|
route={{ name: 'email' }}
|
|
@@ -217,6 +218,7 @@ EmailWrapper.propTypes = {
|
|
|
217
218
|
onResetStep: PropTypes.func,
|
|
218
219
|
isFullMode: PropTypes.bool,
|
|
219
220
|
isUploading: PropTypes.bool,
|
|
221
|
+
setIsLoadingContent: PropTypes.func,
|
|
220
222
|
};
|
|
221
223
|
|
|
222
224
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -175,6 +175,9 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
componentWillUnmount() {
|
|
178
|
+
if (this.props.setIsLoadingContent) {
|
|
179
|
+
this.props.setIsLoadingContent(true); // setting isLoading of CreativesContainer so that slidebox foot can be hidden till content is loaded
|
|
180
|
+
}
|
|
178
181
|
window.removeEventListener("message", this.handleFrameTasks);
|
|
179
182
|
}
|
|
180
183
|
|
|
@@ -923,6 +926,9 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
923
926
|
// if (isLoading && this.state.loadingStatus >= 2) {
|
|
924
927
|
// this.props.creativesContainerActions.hideCreativesContanerLoader();
|
|
925
928
|
// }
|
|
929
|
+
if (!isLoading && this.props.setIsLoadingContent) {
|
|
930
|
+
this.props.setIsLoadingContent(isLoading);
|
|
931
|
+
}
|
|
926
932
|
return isLoading;
|
|
927
933
|
}
|
|
928
934
|
render() {
|
|
@@ -992,6 +998,7 @@ Create.propTypes = {
|
|
|
992
998
|
// creativesContainerActions: PropTypes.object,
|
|
993
999
|
getFormSubscriptionData: PropTypes.func,
|
|
994
1000
|
isFullMode: PropTypes.bool,
|
|
1001
|
+
setIsLoadingContent: PropTypes.func,
|
|
995
1002
|
};
|
|
996
1003
|
|
|
997
1004
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -191,6 +191,9 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
componentWillUnmount() {
|
|
194
|
+
if (this.props.setIsLoadingContent) {
|
|
195
|
+
this.props.setIsLoadingContent(true); // setting isLoading of CreativesContainer so that slidebox foot can be hidden till content is loaded
|
|
196
|
+
}
|
|
194
197
|
window.removeEventListener("message", this.handleFrameTasks);
|
|
195
198
|
}
|
|
196
199
|
|
|
@@ -924,6 +927,9 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
924
927
|
// if (isLoading && this.state.loadingStatus >= 3) {
|
|
925
928
|
// this.props.creativesContainerActions.hideCreativesContanerLoader();
|
|
926
929
|
// }
|
|
930
|
+
if (!isLoading && this.props.setIsLoadingContent) {
|
|
931
|
+
this.props.setIsLoadingContent(isLoading);
|
|
932
|
+
}
|
|
927
933
|
return isLoading;
|
|
928
934
|
}
|
|
929
935
|
render() {
|
|
@@ -997,6 +1003,7 @@ Edit.propTypes = {
|
|
|
997
1003
|
// creativesContainerActions: PropTypes.object,
|
|
998
1004
|
isFullMode: PropTypes.bool,
|
|
999
1005
|
getFormSubscriptionData: PropTypes.func,
|
|
1006
|
+
setIsLoadingContent: PropTypes.func,
|
|
1000
1007
|
};
|
|
1001
1008
|
|
|
1002
1009
|
const mapStateToProps = createStructuredSelector({
|