@capillarytech/creatives-library 2.0.31 → 2.0.33
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/Cap/selectors.js +10 -2
- package/containers/CreativesContainer/SlideBoxContent.js +11 -3
- package/containers/CreativesContainer/SlideBoxFooter.js +3 -3
- package/containers/CreativesContainer/index.js +15 -8
- package/containers/Email/index.js +61 -586
- package/containers/Email/selectors.js +4 -1
- package/containers/EmailWrapper/index.js +12 -4
- package/containers/Sms/Create/index.js +17 -486
- package/containers/Sms/Edit/index.js +17 -6
- package/package.json +1 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// makeSelectLocationState expects a plain JS object for the routing state
|
|
2
2
|
import { createSelector } from 'reselect';
|
|
3
|
-
import Immutable from 'immutable';
|
|
4
3
|
const selectCapDomain = (state) => state.get('cap');
|
|
5
4
|
|
|
6
5
|
const makeSelectAuthenticated = () => createSelector(
|
|
@@ -18,6 +17,10 @@ const makeSelectMetaEntities = () => createSelector(
|
|
|
18
17
|
(globalState) => globalState.get('metaEntities')
|
|
19
18
|
);
|
|
20
19
|
|
|
20
|
+
const isLoadingMetaEntities = () => createSelector(
|
|
21
|
+
selectCapDomain,
|
|
22
|
+
(globalState) => globalState.get('fetchingSchema')
|
|
23
|
+
);
|
|
21
24
|
const makeSelectLocationState = () => {
|
|
22
25
|
let prevRoutingState;
|
|
23
26
|
let prevRoutingStateJS;
|
|
@@ -43,7 +46,10 @@ const makeSelectUser = () => createSelector(
|
|
|
43
46
|
selectCapDomain,
|
|
44
47
|
(globalState) => globalState.get('user')
|
|
45
48
|
);
|
|
46
|
-
|
|
49
|
+
const selectCurrentOrgDetails = () => createSelector(
|
|
50
|
+
selectCapDomain,
|
|
51
|
+
(globalState) => globalState.get('currentOrgDetails').toJS() || null
|
|
52
|
+
);
|
|
47
53
|
export {
|
|
48
54
|
makeSelectLocationState,
|
|
49
55
|
makeSelectAuthenticated,
|
|
@@ -51,4 +57,6 @@ export {
|
|
|
51
57
|
makeSelectOrgId,
|
|
52
58
|
makeSelectMetaEntities,
|
|
53
59
|
makeSelectUser,
|
|
60
|
+
selectCurrentOrgDetails,
|
|
61
|
+
isLoadingMetaEntities,
|
|
54
62
|
};
|
|
@@ -31,8 +31,10 @@ function SlideBoxContent(props) {
|
|
|
31
31
|
onChannelChange,
|
|
32
32
|
onEmailModeChange,
|
|
33
33
|
emailCreateMode,
|
|
34
|
-
|
|
34
|
+
templateStep,
|
|
35
35
|
onEmailNextStep,
|
|
36
|
+
cap,
|
|
37
|
+
onResetStep,
|
|
36
38
|
} = props;
|
|
37
39
|
const type = messageDetails.type.toLowerCase(); // type is context in get tags values : outbound | dvs | referral | loyalty | coupons
|
|
38
40
|
const query = { type: 'embedded', module: 'library' };
|
|
@@ -69,6 +71,7 @@ function SlideBoxContent(props) {
|
|
|
69
71
|
createNew={onCreateNew}
|
|
70
72
|
channel={channel.toLowerCase()}
|
|
71
73
|
onChannelChange={onChannelChange}
|
|
74
|
+
cap={cap}
|
|
72
75
|
/>
|
|
73
76
|
)}
|
|
74
77
|
{isPreview && (
|
|
@@ -112,9 +115,11 @@ function SlideBoxContent(props) {
|
|
|
112
115
|
getFormdata={getFormData}
|
|
113
116
|
templateData={templateData}
|
|
114
117
|
type={type}
|
|
115
|
-
step={
|
|
118
|
+
step={templateStep}
|
|
116
119
|
showNextStep={onEmailNextStep}
|
|
117
120
|
isFullMode={false}
|
|
121
|
+
cap={cap}
|
|
122
|
+
onResetStep={onResetStep}
|
|
118
123
|
/>
|
|
119
124
|
)}
|
|
120
125
|
{(isEditEmailWithId || isEmailEditWithContent) && (
|
|
@@ -130,6 +135,7 @@ function SlideBoxContent(props) {
|
|
|
130
135
|
templateData={templateData}
|
|
131
136
|
getFormSubscriptionData={getFormData}
|
|
132
137
|
getDefaultTags={type}
|
|
138
|
+
cap={cap}
|
|
133
139
|
/>
|
|
134
140
|
)}
|
|
135
141
|
</CreativesWrapper>
|
|
@@ -149,7 +155,9 @@ SlideBoxContent.propTypes = {
|
|
|
149
155
|
currentChannel: PropTypes.string,
|
|
150
156
|
onEmailModeChange: PropTypes.func,
|
|
151
157
|
emailCreateMode: PropTypes.string,
|
|
152
|
-
|
|
158
|
+
templateStep: PropTypes.string,
|
|
153
159
|
onEmailNextStep: PropTypes.func,
|
|
160
|
+
cap: PropTypes.object,
|
|
161
|
+
onResetStep: PropTypes.func,
|
|
154
162
|
};
|
|
155
163
|
export default SlideBoxContent;
|
|
@@ -4,8 +4,8 @@ import { CapButton } from '@capillarytech/cap-ui-library';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import * as constants from './constants';
|
|
6
6
|
function SlideBoxFooter(props) {
|
|
7
|
-
const { slidBoxContent, onSave, messages, onEditTemplate, currentChannel, onEmailNextStep,
|
|
8
|
-
const isEmailCreate = slidBoxContent === 'createTemplate' && currentChannel === constants.EMAIL &&
|
|
7
|
+
const { slidBoxContent, onSave, messages, onEditTemplate, currentChannel, onEmailNextStep, templateStep, emailCreateMode } = props;
|
|
8
|
+
const isEmailCreate = slidBoxContent === 'createTemplate' && currentChannel === constants.EMAIL && templateStep !== 'createTemplate';
|
|
9
9
|
const isCreate = (slidBoxContent === 'editTemplate' || slidBoxContent === 'createTemplate') && !isEmailCreate;
|
|
10
10
|
return (
|
|
11
11
|
<div>
|
|
@@ -36,7 +36,7 @@ SlideBoxFooter.propTypes = {
|
|
|
36
36
|
onEditTemplate: PropTypes.func,
|
|
37
37
|
currentChannel: PropTypes.string,
|
|
38
38
|
onEmailNextStep: PropTypes.func,
|
|
39
|
-
|
|
39
|
+
templateStep: PropTypes.string,
|
|
40
40
|
emailCreateMode: PropTypes.string,
|
|
41
41
|
};
|
|
42
42
|
export default SlideBoxFooter;
|
|
@@ -21,15 +21,15 @@ class Creatives extends React.Component {
|
|
|
21
21
|
constructor(props) {
|
|
22
22
|
super(props);
|
|
23
23
|
this.state = {
|
|
24
|
-
|
|
24
|
+
templateStep: 1, //modeSelection: for template name and (for email selecting upload or editor), and createTemplate to create template create based on modeSelection
|
|
25
25
|
showSlideBox: true,
|
|
26
26
|
slidBoxContent: this.getSlideBocContent({mode: props.creativesMode, templateData: props.templateData, isFullMode: props.isFullMode}),
|
|
27
27
|
templateData: this.getTemplateData(props.templateData),
|
|
28
28
|
currentChannel: this.props.channel || 'sms',
|
|
29
29
|
};
|
|
30
|
-
this.
|
|
30
|
+
this.creativesTemplateSteps = {
|
|
31
31
|
1: 'modeSelection',
|
|
32
|
-
2: 'templateSelection',
|
|
32
|
+
2: 'templateSelection', // only for email in current flows wil be used for mpush, line and wechat as well.
|
|
33
33
|
3: 'createTemplate',
|
|
34
34
|
};
|
|
35
35
|
}
|
|
@@ -61,9 +61,10 @@ class Creatives extends React.Component {
|
|
|
61
61
|
}
|
|
62
62
|
onEmailNextStep = () => {
|
|
63
63
|
this.setState((prevState) => ({
|
|
64
|
-
|
|
64
|
+
templateStep: prevState.templateStep + 1,
|
|
65
65
|
}));
|
|
66
66
|
}
|
|
67
|
+
|
|
67
68
|
onEmailModeChange = (mode) => {
|
|
68
69
|
this.setState({ emailCreateMode: mode});
|
|
69
70
|
}
|
|
@@ -140,6 +141,9 @@ class Creatives extends React.Component {
|
|
|
140
141
|
);
|
|
141
142
|
}
|
|
142
143
|
};
|
|
144
|
+
resetStep = () => {
|
|
145
|
+
this.setState({templateStep: 1});
|
|
146
|
+
}
|
|
143
147
|
toggleShowSlideBox = () => {
|
|
144
148
|
this.setState((prevState) => ({
|
|
145
149
|
...prevState,
|
|
@@ -151,8 +155,8 @@ class Creatives extends React.Component {
|
|
|
151
155
|
};
|
|
152
156
|
|
|
153
157
|
render() {
|
|
154
|
-
const {slidBoxContent, isGetFormData, showSlideBox, templateData, currentChannel, emailCreateMode,
|
|
155
|
-
const {isFullMode, creativesMode} = this.props;
|
|
158
|
+
const {slidBoxContent, isGetFormData, showSlideBox, templateData, currentChannel, emailCreateMode, templateStep} = this.state;
|
|
159
|
+
const {isFullMode, creativesMode, cap} = this.props;
|
|
156
160
|
return (
|
|
157
161
|
<div className={classnames(`${classPrefix}`)}>
|
|
158
162
|
<CapSlideBox
|
|
@@ -183,8 +187,10 @@ class Creatives extends React.Component {
|
|
|
183
187
|
onChannelChange={this.onChannelChange}
|
|
184
188
|
onEmailModeChange={this.onEmailModeChange}//used when create is clicked in email
|
|
185
189
|
emailCreateMode={emailCreateMode}// upload zip || use editor are values
|
|
186
|
-
|
|
190
|
+
templateStep={this.creativesTemplateSteps[templateStep]}
|
|
187
191
|
onEmailNextStep={this.onEmailNextStep}
|
|
192
|
+
onResetStep={this.resetStep}
|
|
193
|
+
cap={cap}
|
|
188
194
|
/>
|
|
189
195
|
}
|
|
190
196
|
footer={
|
|
@@ -195,7 +201,7 @@ class Creatives extends React.Component {
|
|
|
195
201
|
slidBoxContent={slidBoxContent}
|
|
196
202
|
onEmailNextStep={this.onEmailNextStep}
|
|
197
203
|
currentChannel={currentChannel.toUpperCase()}
|
|
198
|
-
|
|
204
|
+
templateStep={this.creativesTemplateSteps[templateStep]}
|
|
199
205
|
emailCreateMode={emailCreateMode}
|
|
200
206
|
/>
|
|
201
207
|
}
|
|
@@ -220,6 +226,7 @@ Creatives.propTypes = {
|
|
|
220
226
|
channel: PropTypes.string,
|
|
221
227
|
templateActions: PropTypes.object,
|
|
222
228
|
globalActions: PropTypes.object,
|
|
229
|
+
cap: PropTypes.object,
|
|
223
230
|
};
|
|
224
231
|
function mapDispatchToProps(dispatch) {
|
|
225
232
|
return {
|