@capillarytech/creatives-library 3.1.34 → 3.1.36
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/package.json +1 -1
- package/v2Components/CapTagList/index.js +2 -2
- package/v2Components/FormBuilder/index.js +4 -1
- package/v2Containers/CreativesContainer/SlideBoxContent.js +4 -0
- package/v2Containers/CreativesContainer/index.js +3 -1
- package/v2Containers/Sms/Create/index.js +2 -0
- package/v2Containers/Sms/Edit/index.js +2 -0
- package/v2Containers/TagList/index.js +33 -0
- package/v2Containers/TemplatesV2/index.js +1 -1
- package/v2Containers/TemplatesV2/_templatesV2.scss +0 -5
package/package.json
CHANGED
|
@@ -143,12 +143,12 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
143
143
|
if (_.has(val, 'subtags')) {
|
|
144
144
|
const temp = this.renderTags(val.subtags);
|
|
145
145
|
list.push((
|
|
146
|
-
<CapTreeNode title={val.name} key={key}>
|
|
146
|
+
<CapTreeNode title={val.name} tag={val} key={val.couponSeriesId ? `${key}(${val.couponSeriesId})` : `${key}`}>
|
|
147
147
|
{temp}
|
|
148
148
|
</CapTreeNode>
|
|
149
149
|
));
|
|
150
150
|
} else if (searchString === '' || !searchString || val.name.toLowerCase().indexOf(searchString.toLowerCase()) !== -1) {
|
|
151
|
-
const tempNode = (<CapTreeNode title={val.name} isLeaf key={key}></CapTreeNode>);
|
|
151
|
+
const tempNode = (<CapTreeNode title={val.name} tag={val} isLeaf key={val.couponSeriesId ? `${key}(${val.couponSeriesId})` : `${key}`}></CapTreeNode>);
|
|
152
152
|
list.push(tempNode);
|
|
153
153
|
}
|
|
154
154
|
});
|
|
@@ -997,7 +997,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
997
997
|
}
|
|
998
998
|
|
|
999
999
|
skipTags(tag) {
|
|
1000
|
-
const regexGroups = ["dynamic_expiry_date_after_\\d+_days.FORMAT_\\d", "unsubscribe\\(#[a-zA-Z\\d]{6}\\)","Link_to_[a-zA-z]","SURVEY.*.TOKEN"];
|
|
1000
|
+
const regexGroups = ["dynamic_expiry_date_after_\\d+_days.FORMAT_\\d", "unsubscribe\\(#[a-zA-Z\\d]{6}\\)","Link_to_[a-zA-z]","SURVEY.*.TOKEN","^[A-Za-z].*\\([\\d]*\\)"];
|
|
1001
1001
|
|
|
1002
1002
|
//const regexGroups = [];
|
|
1003
1003
|
let skipped = false;
|
|
@@ -2312,6 +2312,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2312
2312
|
className={val.className ? val.className : ''}
|
|
2313
2313
|
id={val.id}
|
|
2314
2314
|
userLocale={this.props.userLocale}
|
|
2315
|
+
selectedOfferDetails={this.props.selectedOfferDetails}
|
|
2315
2316
|
/>
|
|
2316
2317
|
</CapColumn>
|
|
2317
2318
|
);
|
|
@@ -2796,6 +2797,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2796
2797
|
className={val.className ? val.className : ''}
|
|
2797
2798
|
id={val.id}
|
|
2798
2799
|
userLocale={this.props.userLocale}
|
|
2800
|
+
selectedOfferDetails={this.props.selectedOfferDetails}
|
|
2799
2801
|
/>
|
|
2800
2802
|
</CapColumn>
|
|
2801
2803
|
);
|
|
@@ -3343,6 +3345,7 @@ FormBuilder.propTypes = {
|
|
|
3343
3345
|
stopValidation: PropTypes.func,
|
|
3344
3346
|
handleDelete: PropTypes.func,
|
|
3345
3347
|
intl: intlShape.isRequired,
|
|
3348
|
+
selectedOfferDetails: PropTypes.array,
|
|
3346
3349
|
};
|
|
3347
3350
|
|
|
3348
3351
|
export default injectIntl(FormBuilder);
|
|
@@ -60,6 +60,7 @@ function SlideBoxContent(props) {
|
|
|
60
60
|
onValidationFail,
|
|
61
61
|
channelsToHide,
|
|
62
62
|
forwardedTags,
|
|
63
|
+
selectedOfferDetails,
|
|
63
64
|
channelsToDisable,
|
|
64
65
|
weChatTemplateType,
|
|
65
66
|
onWechatTemplateChange,
|
|
@@ -176,6 +177,7 @@ function SlideBoxContent(props) {
|
|
|
176
177
|
getDefaultTags={type}
|
|
177
178
|
templateData={templateData}
|
|
178
179
|
forwardedTags={forwardedTags}
|
|
180
|
+
selectedOfferDetails={selectedOfferDetails}
|
|
179
181
|
/>
|
|
180
182
|
)}
|
|
181
183
|
{
|
|
@@ -206,6 +208,7 @@ function SlideBoxContent(props) {
|
|
|
206
208
|
getDefaultTags={type}
|
|
207
209
|
isFullMode={isFullMode}
|
|
208
210
|
forwardedTags={forwardedTags}
|
|
211
|
+
selectedOfferDetails={selectedOfferDetails}
|
|
209
212
|
/>
|
|
210
213
|
)}
|
|
211
214
|
{isEmailCreate && (
|
|
@@ -325,6 +328,7 @@ SlideBoxContent.propTypes = {
|
|
|
325
328
|
onValidationFail: PropTypes.func,
|
|
326
329
|
channelsToHide: PropTypes.array,
|
|
327
330
|
forwardedTags: PropTypes.object,
|
|
331
|
+
selectedOfferDetails: PropTypes.array,
|
|
328
332
|
channelsToDisable: PropTypes.array,
|
|
329
333
|
weChatTemplateType: PropTypes.string,
|
|
330
334
|
onWechatTemplateChange: PropTypes.func,
|
|
@@ -465,7 +465,7 @@ class Creatives extends React.Component {
|
|
|
465
465
|
}
|
|
466
466
|
render() {
|
|
467
467
|
const {slidBoxContent, isGetFormData, showSlideBox, templateData, currentChannel, emailCreateMode, templateStep, isLoadingContent, mobilePushCreateMode, isDiscardMessage, weChatTemplateType, weChatMaptemplateStep} = this.state;
|
|
468
|
-
const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags, channelsToDisable} = this.props;
|
|
468
|
+
const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags, channelsToDisable, selectedOfferDetails} = this.props;
|
|
469
469
|
const mapTemplateCreate = slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
|
|
470
470
|
return (
|
|
471
471
|
<SlideBoxWrapper className={classnames(`${classPrefix} ${isFullMode ? 'creatives-full-mode' : 'creatives-library-mode'} ${mapTemplateCreate ? 'map-template-create' : ''}`)}>
|
|
@@ -522,6 +522,7 @@ class Creatives extends React.Component {
|
|
|
522
522
|
onValidationFail={this.onValidationFail}
|
|
523
523
|
channelsToHide={channelsToHide}
|
|
524
524
|
forwardedTags={forwardedTags}
|
|
525
|
+
selectedOfferDetails={selectedOfferDetails}
|
|
525
526
|
channelsToDisable={channelsToDisable}
|
|
526
527
|
weChatTemplateType={weChatTemplateType}
|
|
527
528
|
onWechatTemplateChange={this.onWechatTemplateChange}
|
|
@@ -574,6 +575,7 @@ Creatives.propTypes = {
|
|
|
574
575
|
EmailLayout: PropTypes.string,
|
|
575
576
|
channelsToHide: PropTypes.array,
|
|
576
577
|
forwardedTags: PropTypes.object,
|
|
578
|
+
selectedOfferDetails: PropTypes.array,
|
|
577
579
|
channelsToDisable: PropTypes.array,
|
|
578
580
|
selectedWeChatAccount: PropTypes.object,
|
|
579
581
|
};
|
|
@@ -970,6 +970,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
970
970
|
router={this.props.router}
|
|
971
971
|
startValidation={this.state.startValidation}
|
|
972
972
|
stopValidation={this.stopValidation}
|
|
973
|
+
selectedOfferDetails={this.props.selectedOfferDetails}
|
|
973
974
|
/>
|
|
974
975
|
</CapColumn>
|
|
975
976
|
</CapRow>
|
|
@@ -995,6 +996,7 @@ Create.propTypes = {
|
|
|
995
996
|
isFullMode: PropTypes.bool,
|
|
996
997
|
getFormSubscriptionData: PropTypes.func,
|
|
997
998
|
isLoadingMetaEntities: PropTypes.bool,
|
|
999
|
+
selectedOfferDetails: PropTypes.array,
|
|
998
1000
|
};
|
|
999
1001
|
|
|
1000
1002
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -966,6 +966,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
966
966
|
router={this.props.router}
|
|
967
967
|
startValidation={this.state.startValidation}
|
|
968
968
|
stopValidation={this.stopValidation}
|
|
969
|
+
selectedOfferDetails={this.props.selectedOfferDetails}
|
|
969
970
|
/>
|
|
970
971
|
</CapColumn>
|
|
971
972
|
</CapRow>
|
|
@@ -994,6 +995,7 @@ Edit.propTypes = {
|
|
|
994
995
|
setIsLoadingContent: PropTypes.func,
|
|
995
996
|
// route: PropTypes.object,
|
|
996
997
|
injectedTags: PropTypes.object,
|
|
998
|
+
selectedOfferDetails: PropTypes.array,
|
|
997
999
|
};
|
|
998
1000
|
|
|
999
1001
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -31,6 +31,7 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
31
31
|
this.populateTags = this.populateTags.bind(this);
|
|
32
32
|
this.populateTagForChildren = this.populateTagForChildren.bind(this);
|
|
33
33
|
this.transformInjectedTags = this.transformInjectedTags.bind(this);
|
|
34
|
+
this.transformCouponTags = this.transformCouponTags.bind(this);
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
componentDidMount() {
|
|
@@ -138,6 +139,34 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
138
139
|
return tagsObject[tagValue];
|
|
139
140
|
}
|
|
140
141
|
|
|
142
|
+
transformCouponTags(offerDetails, allTags) {
|
|
143
|
+
const couponTags = {};
|
|
144
|
+
offerDetails.forEach((offer) => {
|
|
145
|
+
const { id, couponName } = offer;
|
|
146
|
+
const couponTagsKeys = (allTags.coupon && allTags.coupon.subtags && Object.keys(allTags.coupon.subtags)) || [];
|
|
147
|
+
const couponSubTags = {};
|
|
148
|
+
couponTagsKeys.forEach((couponTagKey) => {
|
|
149
|
+
const couponSubTagsObj = {
|
|
150
|
+
...allTags.coupon.subtags[couponTagKey],
|
|
151
|
+
couponSeriesId: id,
|
|
152
|
+
};
|
|
153
|
+
couponSubTags[couponTagKey] = couponSubTagsObj;
|
|
154
|
+
});
|
|
155
|
+
const key = couponName || id;
|
|
156
|
+
couponTags[key] = {
|
|
157
|
+
'tag-header': true,
|
|
158
|
+
'name': couponName || id,
|
|
159
|
+
'desc': couponName || id,
|
|
160
|
+
'couponSeriesId': id,
|
|
161
|
+
'subtags': couponSubTags,
|
|
162
|
+
'resolved': true,
|
|
163
|
+
'couponTags': true,
|
|
164
|
+
};
|
|
165
|
+
});
|
|
166
|
+
// eslint-disable-next-line no-param-reassign
|
|
167
|
+
allTags.coupon.subtags = couponTags;
|
|
168
|
+
}
|
|
169
|
+
|
|
141
170
|
transformInjectedTags(tags) {
|
|
142
171
|
_.forEach(tags, (tag) => {
|
|
143
172
|
const temp = tag;
|
|
@@ -189,6 +218,9 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
189
218
|
tags = this.populateTags(this.props.tags);
|
|
190
219
|
console.log('populating tags', tags);
|
|
191
220
|
}
|
|
221
|
+
if (this.props.selectedOfferDetails && !_.isEmpty(this.props.selectedOfferDetails) && (tags && tags.coupon)) {
|
|
222
|
+
this.transformCouponTags(this.props.selectedOfferDetails, tags);
|
|
223
|
+
}
|
|
192
224
|
tags = _.merge( {}, tags, injectedTags);
|
|
193
225
|
console.log('merged tags', tags);
|
|
194
226
|
return (
|
|
@@ -220,6 +252,7 @@ TagList.propTypes = {
|
|
|
220
252
|
moduleFilterEnabled: PropTypes.bool,
|
|
221
253
|
className: PropTypes.string,
|
|
222
254
|
userLocale: PropTypes.string,
|
|
255
|
+
selectedOfferDetails: PropTypes.array,
|
|
223
256
|
};
|
|
224
257
|
|
|
225
258
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -78,7 +78,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
78
78
|
selectedChannel: defaultChannel,
|
|
79
79
|
panes,
|
|
80
80
|
};
|
|
81
|
-
this.props.onChannelChange(defaultChannel);
|
|
81
|
+
!props.isFullMode && this.props.onChannelChange(defaultChannel);
|
|
82
82
|
}
|
|
83
83
|
componentWillReceiveProps(nextProps) {
|
|
84
84
|
if (this.props.channel !== nextProps.channel) {
|