@capillarytech/creatives-library 8.0.112 → 8.0.113
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
|
@@ -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,7 +178,9 @@ 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
|
} else if (ctaType === PHONE_NUMBER && phone_number.length < 5) {
|
|
@@ -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;
|
|
@@ -249,7 +252,7 @@ export const CapWhatsappCTA = (props) => {
|
|
|
249
252
|
: formatMessage(messages.ctaWebsiteTypeDynamic)}
|
|
250
253
|
</CapLabel>
|
|
251
254
|
</CapColumn>
|
|
252
|
-
<CapTooltip title={url} placement=
|
|
255
|
+
<CapTooltip title={url} placement="top">
|
|
253
256
|
<CapColumn span={7} style={{ marginRight: '0px' }}>
|
|
254
257
|
<CapLabel className="url">{url}</CapLabel>
|
|
255
258
|
</CapColumn>
|
|
@@ -279,6 +282,7 @@ export const CapWhatsappCTA = (props) => {
|
|
|
279
282
|
tags={tags}
|
|
280
283
|
injectedTags={injectedTags}
|
|
281
284
|
selectedOfferDetails={selectedOfferDetails}
|
|
285
|
+
eventContextTags={eventContextTags}
|
|
282
286
|
/>
|
|
283
287
|
</CapColumn>
|
|
284
288
|
)}
|
|
@@ -290,7 +294,7 @@ export const CapWhatsappCTA = (props) => {
|
|
|
290
294
|
>
|
|
291
295
|
<CapTooltip
|
|
292
296
|
title={formatMessage(messages.whatsappCtaTagListRevert)}
|
|
293
|
-
placement=
|
|
297
|
+
placement="top"
|
|
294
298
|
>
|
|
295
299
|
<CapIcon size="s" type="return" />
|
|
296
300
|
</CapTooltip>
|
|
@@ -423,7 +427,7 @@ export const CapWhatsappCTA = (props) => {
|
|
|
423
427
|
? formatMessage(messages.ctaSaveDisabled)
|
|
424
428
|
: ''
|
|
425
429
|
}
|
|
426
|
-
placement=
|
|
430
|
+
placement="bottom"
|
|
427
431
|
>
|
|
428
432
|
<div className="button-disabled-tooltip-wrapper">
|
|
429
433
|
<CapButton
|
|
@@ -451,15 +455,15 @@ export const CapWhatsappCTA = (props) => {
|
|
|
451
455
|
{
|
|
452
456
|
// when first button is not saved, add button is disabled with tooltip
|
|
453
457
|
// eslint-disable-next-line no-unused-expressions
|
|
454
|
-
ctaData.length < 2
|
|
455
|
-
!isEditFlow
|
|
456
|
-
renderArray.push(
|
|
458
|
+
ctaData.length < 2
|
|
459
|
+
&& !isEditFlow
|
|
460
|
+
&& renderArray.push(
|
|
457
461
|
<CapRow>
|
|
458
462
|
<CapTooltip
|
|
459
463
|
title={
|
|
460
464
|
addBtnDisabled ? formatMessage(messages.ctaAddDisabled) : ''
|
|
461
465
|
}
|
|
462
|
-
placement=
|
|
466
|
+
placement="right"
|
|
463
467
|
>
|
|
464
468
|
<div className="button-disabled-tooltip-wrapper">
|
|
465
469
|
<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,31 @@ 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) => {
|
|
77
|
-
|
|
78
|
-
};
|
|
79
|
-
|
|
80
79
|
getTagsforContext = (data) => {
|
|
81
80
|
//this.setState({loading: true});
|
|
82
81
|
this.props.onContextChange(data);
|
|
83
82
|
}
|
|
83
|
+
|
|
84
84
|
generateTags = (props) => {
|
|
85
85
|
let tags = {};
|
|
86
86
|
let injectedTags = {};
|
|
@@ -116,7 +116,9 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
116
116
|
};
|
|
117
117
|
|
|
118
118
|
eventContextTags.forEach((tag) => {
|
|
119
|
-
const {
|
|
119
|
+
const {
|
|
120
|
+
tagName, label, profileId, profileName,
|
|
121
|
+
} = tag || {};
|
|
120
122
|
if (!profileId || !tagName || !label || !profileName) return;
|
|
121
123
|
// Initializing the tags profile if it doesn't exist
|
|
122
124
|
if (!eventContextTagsObj?.eventContextTags?.subtags?.[profileId]) {
|
|
@@ -124,7 +126,7 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
124
126
|
name: profileName,
|
|
125
127
|
desc: profileName,
|
|
126
128
|
resolved: true,
|
|
127
|
-
|
|
129
|
+
'tag-header': true,
|
|
128
130
|
subtags: {},
|
|
129
131
|
};
|
|
130
132
|
}
|
|
@@ -138,6 +140,7 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
138
140
|
}
|
|
139
141
|
this.setState({tags: _.merge( {}, tags, injectedTags, eventContextTagsObj )});
|
|
140
142
|
}
|
|
143
|
+
|
|
141
144
|
populateTags(tagsList) {
|
|
142
145
|
const mainTags = {};
|
|
143
146
|
const excludedTags = [];
|
|
@@ -245,7 +248,9 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
245
248
|
};
|
|
246
249
|
};
|
|
247
250
|
offerDetails.forEach((offer) => {
|
|
248
|
-
const {
|
|
251
|
+
const {
|
|
252
|
+
id, couponName, description, couponSeriesId,
|
|
253
|
+
} = offer;
|
|
249
254
|
const couponId = id || couponSeriesId;
|
|
250
255
|
const couponSubTags = {};
|
|
251
256
|
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 && (
|