@capillarytech/creatives-library 8.0.110 → 8.0.111-alpha.0
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
CHANGED
|
@@ -343,14 +343,9 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
343
343
|
const {formatMessage} = intl;
|
|
344
344
|
const { tagValue, expandedKeys, autoExpandParent, searchValue, visible, translationLang } = this.state;
|
|
345
345
|
const options = [
|
|
346
|
-
{
|
|
347
|
-
value: "All",
|
|
348
|
-
label: formatMessage(messages.all),
|
|
349
|
-
key: 'all',
|
|
350
|
-
},
|
|
351
346
|
{
|
|
352
347
|
value: "Outbound",
|
|
353
|
-
label: formatMessage(messages.
|
|
348
|
+
label: formatMessage(messages.Standard),
|
|
354
349
|
key: 'outbound',
|
|
355
350
|
},
|
|
356
351
|
{
|
|
@@ -370,7 +365,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
370
365
|
getPopupContainer={(triggerNode) => triggerNode.parentNode}
|
|
371
366
|
style={{width: '250px', marginBottom: '16px', minWidth: 'initial', display: 'inherit'}}
|
|
372
367
|
onChange={this.props.onContextChange}
|
|
373
|
-
defaultValue={
|
|
368
|
+
defaultValue={'Outbound'}
|
|
374
369
|
options={options}>
|
|
375
370
|
</CapSelect> : ''}
|
|
376
371
|
<CapTree
|
|
@@ -26,9 +26,9 @@ export default defineMessages({
|
|
|
26
26
|
id: 'creatives.componentsV2.CapTagList.all',
|
|
27
27
|
defaultMessage: 'All',
|
|
28
28
|
},
|
|
29
|
-
"
|
|
30
|
-
id: 'creatives.componentsV2.CapTagList.
|
|
31
|
-
defaultMessage: '
|
|
29
|
+
"Standard": {
|
|
30
|
+
id: 'creatives.componentsV2.CapTagList.Standard',
|
|
31
|
+
defaultMessage: 'Standard',
|
|
32
32
|
},
|
|
33
33
|
"loyalty": {
|
|
34
34
|
id: 'creatives.componentsV2.CapTagList.loyalty',
|
|
@@ -20,7 +20,7 @@ import globalMessages from '../../v2Containers/Cap/messages';
|
|
|
20
20
|
import whatsappMsg from '../../v2Containers/Whatsapp/messages';
|
|
21
21
|
import messages from './messages';
|
|
22
22
|
import './index.scss';
|
|
23
|
-
import { isUrl,isValidText } from '../../v2Containers/Line/Container/Wrapper/utils';
|
|
23
|
+
import { isUrl, isValidText } from '../../v2Containers/Line/Container/Wrapper/utils';
|
|
24
24
|
import TagList from '../../v2Containers/TagList';
|
|
25
25
|
import {
|
|
26
26
|
CTA_OPTIONS,
|
|
@@ -51,6 +51,7 @@ export const CapWhatsappCTA = (props) => {
|
|
|
51
51
|
tags = [],
|
|
52
52
|
injectedTags = {},
|
|
53
53
|
selectedOfferDetails = [],
|
|
54
|
+
eventContextTags = [],
|
|
54
55
|
} = props;
|
|
55
56
|
const { formatMessage } = intl;
|
|
56
57
|
const invalidVarRegex = /{{(.*?)}}/g;
|
|
@@ -135,8 +136,7 @@ export const CapWhatsappCTA = (props) => {
|
|
|
135
136
|
clonedCta.push(cloneDeep(INITIAL_CTA_DATA[0]));
|
|
136
137
|
if (clonedCta.length === 2) {
|
|
137
138
|
clonedCta[1].index = 1;
|
|
138
|
-
clonedCta[1].ctaType =
|
|
139
|
-
clonedCta[0].ctaType === PHONE_NUMBER ? WEBSITE : PHONE_NUMBER;
|
|
139
|
+
clonedCta[1].ctaType = clonedCta[0].ctaType === PHONE_NUMBER ? WEBSITE : PHONE_NUMBER;
|
|
140
140
|
}
|
|
141
141
|
updateHandler(clonedCta, null, true);
|
|
142
142
|
};
|
|
@@ -168,8 +168,8 @@ export const CapWhatsappCTA = (props) => {
|
|
|
168
168
|
if (!isUrl(value)) {
|
|
169
169
|
errorMessage = formatMessage(messages.ctaWebsiteUrlErrorMessage);
|
|
170
170
|
} else if (
|
|
171
|
-
urlType === STATIC_URL
|
|
172
|
-
value.match(invalidVarRegex)?.length > 0
|
|
171
|
+
urlType === STATIC_URL
|
|
172
|
+
&& value.match(invalidVarRegex)?.length > 0
|
|
173
173
|
) {
|
|
174
174
|
errorMessage = formatMessage(messages.staticUrlWithVarErrorMessage);
|
|
175
175
|
}
|
|
@@ -178,12 +178,14 @@ export const CapWhatsappCTA = (props) => {
|
|
|
178
178
|
};
|
|
179
179
|
|
|
180
180
|
const ctaSaveDisabled = (index) => {
|
|
181
|
-
const {
|
|
181
|
+
const {
|
|
182
|
+
ctaType, text, phone_number, url,
|
|
183
|
+
} = ctaData[index] || {};
|
|
182
184
|
if (text === '' || buttonError) {
|
|
183
185
|
return true;
|
|
184
|
-
}
|
|
186
|
+
} if (ctaType === PHONE_NUMBER && phone_number.length < 5) {
|
|
185
187
|
return true;
|
|
186
|
-
}
|
|
188
|
+
} if (ctaType === WEBSITE && (url === '' || urlError)) {
|
|
187
189
|
return true;
|
|
188
190
|
}
|
|
189
191
|
return false;
|
|
@@ -208,8 +210,9 @@ export const CapWhatsappCTA = (props) => {
|
|
|
208
210
|
const renderArray = [];
|
|
209
211
|
const addBtnDisabled = ctaData.length === 1 && !ctaData[0].isSaved;
|
|
210
212
|
ctaData.forEach((cta) => {
|
|
211
|
-
const {
|
|
212
|
-
|
|
213
|
+
const {
|
|
214
|
+
index, ctaType, text, phone_number, urlType, url, isSaved,
|
|
215
|
+
} = cta || {};
|
|
213
216
|
//this is to display buttons after they are saved, in both create and edit mode.
|
|
214
217
|
if (isSaved) {
|
|
215
218
|
const ctaIsPhone = ctaType === PHONE_NUMBER;
|
|
@@ -237,7 +240,10 @@ export const CapWhatsappCTA = (props) => {
|
|
|
237
240
|
</CapColumn>
|
|
238
241
|
{ctaIsPhone && (
|
|
239
242
|
<CapColumn span={10} align="left">
|
|
240
|
-
<CapLabel className="phone"
|
|
243
|
+
<CapLabel className="phone">
|
|
244
|
+
+
|
|
245
|
+
{phone_number}
|
|
246
|
+
</CapLabel>
|
|
241
247
|
</CapColumn>
|
|
242
248
|
)}
|
|
243
249
|
{!ctaIsPhone && (
|
|
@@ -249,7 +255,7 @@ export const CapWhatsappCTA = (props) => {
|
|
|
249
255
|
: formatMessage(messages.ctaWebsiteTypeDynamic)}
|
|
250
256
|
</CapLabel>
|
|
251
257
|
</CapColumn>
|
|
252
|
-
<CapTooltip title={url} placement=
|
|
258
|
+
<CapTooltip title={url} placement="top">
|
|
253
259
|
<CapColumn span={7} style={{ marginRight: '0px' }}>
|
|
254
260
|
<CapLabel className="url">{url}</CapLabel>
|
|
255
261
|
</CapColumn>
|
|
@@ -279,6 +285,7 @@ export const CapWhatsappCTA = (props) => {
|
|
|
279
285
|
tags={tags}
|
|
280
286
|
injectedTags={injectedTags}
|
|
281
287
|
selectedOfferDetails={selectedOfferDetails}
|
|
288
|
+
eventContextTags={eventContextTags}
|
|
282
289
|
/>
|
|
283
290
|
</CapColumn>
|
|
284
291
|
)}
|
|
@@ -290,7 +297,7 @@ export const CapWhatsappCTA = (props) => {
|
|
|
290
297
|
>
|
|
291
298
|
<CapTooltip
|
|
292
299
|
title={formatMessage(messages.whatsappCtaTagListRevert)}
|
|
293
|
-
placement=
|
|
300
|
+
placement="top"
|
|
294
301
|
>
|
|
295
302
|
<CapIcon size="s" type="return" />
|
|
296
303
|
</CapTooltip>
|
|
@@ -423,7 +430,7 @@ export const CapWhatsappCTA = (props) => {
|
|
|
423
430
|
? formatMessage(messages.ctaSaveDisabled)
|
|
424
431
|
: ''
|
|
425
432
|
}
|
|
426
|
-
placement=
|
|
433
|
+
placement="bottom"
|
|
427
434
|
>
|
|
428
435
|
<div className="button-disabled-tooltip-wrapper">
|
|
429
436
|
<CapButton
|
|
@@ -451,15 +458,15 @@ export const CapWhatsappCTA = (props) => {
|
|
|
451
458
|
{
|
|
452
459
|
// when first button is not saved, add button is disabled with tooltip
|
|
453
460
|
// eslint-disable-next-line no-unused-expressions
|
|
454
|
-
ctaData.length < 2
|
|
455
|
-
!isEditFlow
|
|
456
|
-
renderArray.push(
|
|
461
|
+
ctaData.length < 2
|
|
462
|
+
&& !isEditFlow
|
|
463
|
+
&& renderArray.push(
|
|
457
464
|
<CapRow>
|
|
458
465
|
<CapTooltip
|
|
459
466
|
title={
|
|
460
467
|
addBtnDisabled ? formatMessage(messages.ctaAddDisabled) : ''
|
|
461
468
|
}
|
|
462
|
-
placement=
|
|
469
|
+
placement="right"
|
|
463
470
|
>
|
|
464
471
|
<div className="button-disabled-tooltip-wrapper">
|
|
465
472
|
<CapButton
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
|
|
9
9
|
import React from 'react';
|
|
10
|
+
import { injectIntl } from 'react-intl';
|
|
10
11
|
import { connect } from 'react-redux';
|
|
11
12
|
import { Tree } from 'antd';
|
|
12
13
|
import _ from 'lodash';
|
|
@@ -16,17 +17,20 @@ import makeSelectTagList from './selectors';
|
|
|
16
17
|
import { UserIsAuthenticated } from '../../utils/authWrapper';
|
|
17
18
|
import * as actions from './actions';
|
|
18
19
|
import * as globalActions from '../Cap/actions';
|
|
20
|
+
import messages, { scope } from './messages';
|
|
21
|
+
|
|
19
22
|
// import styled from styled-components;
|
|
20
23
|
import CapTagList from '../../v2Components/CapTagList';
|
|
21
24
|
import './_tagList.scss';
|
|
22
25
|
import { selectCurrentOrgDetails, makeSelectFetchingSchemaError } from '../Cap/selectors';
|
|
23
|
-
import {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
import {
|
|
27
|
-
|
|
26
|
+
import {
|
|
27
|
+
handleInjectedData, hasGiftVoucherFeature, hasPromoFeature, hasBadgesFeature, transformBadgeTags,
|
|
28
|
+
} from '../../utils/common';
|
|
29
|
+
import {
|
|
30
|
+
GIFT_VOUCHER_RELATED_TAGS, PROMO_ENGINE_RELATED_TAGS, BADGES_RELATED_TAGS, BADGES_ENROLL, BADGES_ISSUE,
|
|
31
|
+
} from '../../containers/App/constants';
|
|
28
32
|
|
|
29
|
-
const TreeNode = Tree
|
|
33
|
+
const {TreeNode} = Tree;
|
|
30
34
|
|
|
31
35
|
export class TagList extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
32
36
|
constructor(props) {
|
|
@@ -52,35 +56,35 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
52
56
|
this.setState({loading: true});
|
|
53
57
|
}
|
|
54
58
|
if (!_.isEqual(nextProps.injectedTags, this.props.injectedTags)) {
|
|
55
|
-
|
|
56
59
|
this.setState({loading: false});
|
|
57
60
|
}
|
|
58
61
|
if (!_.isEqual(nextProps.tags, this.props.tags)) {
|
|
59
|
-
|
|
60
62
|
this.setState({loading: false});
|
|
61
63
|
}
|
|
62
64
|
if (nextProps?.fetchingSchemaError) {
|
|
63
65
|
this.setState({tagsError: nextProps?.fetchingSchemaError});
|
|
64
66
|
}
|
|
65
|
-
|
|
66
67
|
}
|
|
68
|
+
|
|
67
69
|
componentDidUpdate(prevProps) {
|
|
68
70
|
if (this.props.tags !== prevProps.tags || this.props.injectedTags !== prevProps.injectedTags || this.props.selectedOfferDetails !== prevProps.selectedOfferDetails) {
|
|
69
71
|
this.generateTags(this.props);
|
|
70
72
|
}
|
|
71
73
|
}
|
|
74
|
+
|
|
72
75
|
onSelect = (selectedKeys) => {
|
|
73
76
|
this.props.onTagSelect(selectedKeys[0]);
|
|
74
77
|
};
|
|
75
78
|
|
|
76
|
-
onClick = (e, data) => {
|
|
79
|
+
// onClick = (e, data) => {
|
|
77
80
|
|
|
78
|
-
};
|
|
81
|
+
// };
|
|
79
82
|
|
|
80
83
|
getTagsforContext = (data) => {
|
|
81
84
|
//this.setState({loading: true});
|
|
82
85
|
this.props.onContextChange(data);
|
|
83
86
|
}
|
|
87
|
+
|
|
84
88
|
generateTags = (props) => {
|
|
85
89
|
let tags = {};
|
|
86
90
|
let injectedTags = {};
|
|
@@ -108,24 +112,26 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
108
112
|
if (eventContextTags?.length) {
|
|
109
113
|
const TAG_HEADER_MSG_LABEL = this.props.intl.formatMessage(messages.entryEvent);
|
|
110
114
|
eventContextTagsObj.eventContextTags = {
|
|
111
|
-
name: TAG_HEADER_MSG_LABEL,
|
|
112
|
-
desc: TAG_HEADER_MSG_LABEL,
|
|
113
|
-
resolved: true,
|
|
115
|
+
"name": TAG_HEADER_MSG_LABEL,
|
|
116
|
+
"desc": TAG_HEADER_MSG_LABEL,
|
|
117
|
+
"resolved": true,
|
|
114
118
|
'tag-header': true,
|
|
115
|
-
subtags: {},
|
|
119
|
+
"subtags": {},
|
|
116
120
|
};
|
|
117
121
|
|
|
118
122
|
eventContextTags.forEach((tag) => {
|
|
119
|
-
const {
|
|
123
|
+
const {
|
|
124
|
+
tagName, label, profileId, profileName,
|
|
125
|
+
} = tag || {};
|
|
120
126
|
if (!profileId || !tagName || !label || !profileName) return;
|
|
121
127
|
// Initializing the tags profile if it doesn't exist
|
|
122
128
|
if (!eventContextTagsObj?.eventContextTags?.subtags?.[profileId]) {
|
|
123
129
|
eventContextTagsObj.eventContextTags.subtags[profileId] = {
|
|
124
|
-
name: profileName,
|
|
125
|
-
desc: profileName,
|
|
126
|
-
resolved: true,
|
|
130
|
+
"name": profileName,
|
|
131
|
+
"desc": profileName,
|
|
132
|
+
"resolved": true,
|
|
127
133
|
"tag-header": true,
|
|
128
|
-
subtags: {},
|
|
134
|
+
"subtags": {},
|
|
129
135
|
};
|
|
130
136
|
}
|
|
131
137
|
// Adding the current tag to the profile group
|
|
@@ -138,6 +144,7 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
138
144
|
}
|
|
139
145
|
this.setState({tags: _.merge( {}, tags, injectedTags, eventContextTagsObj )});
|
|
140
146
|
}
|
|
147
|
+
|
|
141
148
|
populateTags(tagsList) {
|
|
142
149
|
const mainTags = {};
|
|
143
150
|
const excludedTags = [];
|
|
@@ -164,8 +171,8 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
164
171
|
}
|
|
165
172
|
if (!tag['tag-header']) {
|
|
166
173
|
mainTags[tag.value] = {
|
|
167
|
-
|
|
168
|
-
|
|
174
|
+
name: tag?.label[userLocale] ? tag?.label[userLocale] : tag?.label?.en,
|
|
175
|
+
desc: tag?.label[userLocale] ? tag?.label[userLocale] : tag?.label?.en,
|
|
169
176
|
};
|
|
170
177
|
} else if (tag['tag-header'] && mainTags[tag.value]) {
|
|
171
178
|
mainTags[tag.value].subtags = _.concat(mainTags[tag.value].subtags, tag.subtags);
|
|
@@ -245,7 +252,9 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
245
252
|
};
|
|
246
253
|
};
|
|
247
254
|
offerDetails.forEach((offer) => {
|
|
248
|
-
const {
|
|
255
|
+
const {
|
|
256
|
+
id, couponName, description, couponSeriesId,
|
|
257
|
+
} = offer;
|
|
249
258
|
const couponId = id || couponSeriesId;
|
|
250
259
|
const couponSubTags = {};
|
|
251
260
|
couponTagsKeys.forEach((couponTagKey) => {
|
|
@@ -882,6 +882,10 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
882
882
|
deleteHandler={deleteHandler}
|
|
883
883
|
isEditFlow={isEditFlow}
|
|
884
884
|
hostName={host}
|
|
885
|
+
tags={tags || []}
|
|
886
|
+
injectedTags={injectedTags || {}}
|
|
887
|
+
selectedOfferDetails={selectedOfferDetails}
|
|
888
|
+
eventContextTags={eventContextTags}
|
|
885
889
|
/>
|
|
886
890
|
)}
|
|
887
891
|
</>
|
|
@@ -2697,6 +2701,7 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
2697
2701
|
tags={tags || []}
|
|
2698
2702
|
injectedTags={injectedTags || {}}
|
|
2699
2703
|
selectedOfferDetails={selectedOfferDetails}
|
|
2704
|
+
eventContextTags={eventContextTags}
|
|
2700
2705
|
/>
|
|
2701
2706
|
)}
|
|
2702
2707
|
{isBtnTypeQuickReply && (
|