@capillarytech/creatives-library 9.0.15-alpha.3 → 9.0.16-beta.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/AppRoot.js +80 -0
- package/app.js +5 -3
- package/constants/unified.js +0 -29
- package/entry.js +67 -1
- package/global-styles.js +1 -1
- package/mfe-exposed-components.js +2 -4
- package/package.json +2 -2
- package/services/api.js +1 -1
- package/services/tests/api.test.js +20 -35
- package/styles/containers/layout/_layoutPage.scss +8 -6
- package/utils/commonUtils.js +1 -19
- package/utils/getDataLayer.js +15 -0
- package/utils/gtmTrackers/gtmEvents/creativeDetails.js +2 -1
- package/utils/mfeDetect.js +1 -0
- package/v2Components/CapActionButton/constants.js +1 -8
- package/v2Components/CapActionButton/index.js +144 -202
- package/v2Components/CapActionButton/index.scss +14 -232
- package/v2Components/CapActionButton/messages.js +3 -19
- package/v2Components/CapActionButton/tests/index.test.js +18 -42
- package/v2Components/CapImageUpload/index.js +2 -2
- package/v2Components/CapTagList/index.js +0 -10
- package/v2Components/CommonTestAndPreview/CustomValuesEditor.js +48 -70
- package/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +2 -8
- package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +21 -214
- package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +0 -16
- package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +9 -83
- package/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +0 -30
- package/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +11 -60
- package/v2Components/CommonTestAndPreview/SendTestMessage.js +5 -10
- package/v2Components/CommonTestAndPreview/UnifiedPreview/RcsPreviewContent.js +22 -202
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +80 -381
- package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +8 -155
- package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +0 -11
- package/v2Components/CommonTestAndPreview/constants.js +2 -38
- package/v2Components/CommonTestAndPreview/index.js +222 -761
- package/v2Components/CommonTestAndPreview/messages.js +3 -45
- package/v2Components/CommonTestAndPreview/sagas.js +6 -25
- package/v2Components/CommonTestAndPreview/tests/CommonTestAndPreview.addTestCustomer.test.js +0 -1
- package/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +267 -284
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +65 -231
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +5 -118
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +0 -341
- package/v2Components/CommonTestAndPreview/tests/PreviewSection.test.js +1 -8
- package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +13 -34
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/RcsPreviewContent.test.js +283 -281
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +1 -199
- package/v2Components/CommonTestAndPreview/tests/index.test.js +4 -133
- package/v2Components/CommonTestAndPreview/tests/sagas.test.js +24 -31
- package/v2Components/NavigationBar/index.js +9 -7
- package/v2Components/NavigationBar/mfeModuleHeader.config.js +16 -0
- package/v2Components/Pagination/_pagination.scss +2 -0
- package/v2Components/TemplatePreview/_templatePreview.scss +25 -45
- package/v2Components/TemplatePreview/index.js +32 -147
- package/v2Components/TemplatePreview/tests/index.test.js +0 -142
- package/v2Components/TestAndPreviewSlidebox/CustomValuesEditor.js +6 -6
- package/v2Components/TestAndPreviewSlidebox/index.js +1 -13
- package/v2Components/TestAndPreviewSlidebox/sagas.js +4 -11
- package/v2Components/TestAndPreviewSlidebox/tests/saga.test.js +1 -3
- package/v2Containers/Cap/constants.js +1 -0
- package/v2Containers/Cap/index.js +47 -21
- package/v2Containers/Cap/sagas.js +19 -0
- package/v2Containers/CommunicationFlow/Tests/CommunicationFlow.test.js +1 -4
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/DeliverySettingsSection.test.js +0 -4
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/SenderDetails.test.js +20 -20
- package/v2Containers/CreativesContainer/SlideBoxContent.js +7 -37
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +5 -14
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +5 -36
- package/v2Containers/CreativesContainer/constants.js +0 -11
- package/v2Containers/CreativesContainer/index.js +104 -323
- package/v2Containers/CreativesContainer/index.scss +1 -83
- package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +34 -79
- package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +16 -79
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +0 -8
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +90 -333
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +15 -20
- package/v2Containers/CreativesContainer/tests/index.test.js +9 -71
- package/v2Containers/MobilePush/Create/test/saga.test.js +2 -2
- package/v2Containers/Rcs/constants.js +11 -131
- package/v2Containers/Rcs/index.js +829 -2682
- package/v2Containers/Rcs/index.scss +8 -443
- package/v2Containers/Rcs/messages.js +6 -45
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +39409 -74176
- package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap +74 -10
- package/v2Containers/Rcs/tests/index.test.js +40 -151
- package/v2Containers/Rcs/tests/mockData.js +0 -38
- package/v2Containers/Rcs/tests/utils.test.js +30 -643
- package/v2Containers/Rcs/utils.js +12 -466
- package/v2Containers/Sms/Create/index.js +48 -115
- package/v2Containers/SmsTrai/Create/index.js +4 -9
- package/v2Containers/SmsTrai/Edit/constants.js +0 -2
- package/v2Containers/SmsTrai/Edit/index.js +169 -678
- package/v2Containers/SmsTrai/Edit/messages.js +4 -14
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +2854 -5455
- package/v2Containers/SmsWrapper/index.js +8 -37
- package/v2Containers/TagList/index.js +0 -6
- package/v2Containers/Templates/_templates.scss +11 -196
- package/v2Containers/Templates/actions.js +0 -11
- package/v2Containers/Templates/constants.js +0 -2
- package/v2Containers/Templates/index.js +60 -131
- package/v2Containers/Templates/sagas.js +13 -57
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1015 -1060
- package/v2Containers/Templates/tests/sagas.test.js +16 -199
- package/v2Containers/TemplatesV2/TemplatesV2.style.js +10 -75
- package/v2Containers/TemplatesV2/index.js +43 -86
- package/v2Containers/WeChat/MapTemplates/test/saga.test.js +9 -9
- package/v2Containers/Whatsapp/index.js +25 -4
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +34 -578
- package/utils/rcsPayloadUtils.js +0 -92
- package/utils/templateVarUtils.js +0 -201
- package/utils/tests/rcsPayloadUtils.test.js +0 -226
- package/utils/tests/templateVarUtils.test.js +0 -204
- package/v2Components/CommonTestAndPreview/previewApiUtils.js +0 -59
- package/v2Components/CommonTestAndPreview/tests/previewApiUtils.test.js +0 -67
- package/v2Components/CommonTestAndPreview/utils.js +0 -84
- package/v2Components/SmsFallback/SmsFallbackLocalSelector.js +0 -91
- package/v2Components/SmsFallback/constants.js +0 -94
- package/v2Components/SmsFallback/index.js +0 -958
- package/v2Components/SmsFallback/index.scss +0 -266
- package/v2Components/SmsFallback/messages.js +0 -78
- package/v2Components/SmsFallback/smsFallbackUtils.js +0 -120
- package/v2Components/SmsFallback/tests/SmsFallbackLocalSelector.test.js +0 -50
- package/v2Components/SmsFallback/tests/rcsSmsFallback.acceptance.test.js +0 -147
- package/v2Components/SmsFallback/tests/smsFallbackHandlers.test.js +0 -304
- package/v2Components/SmsFallback/tests/smsFallbackUi.test.js +0 -208
- package/v2Components/SmsFallback/tests/smsFallbackUtils.test.js +0 -309
- package/v2Components/SmsFallback/tests/useLocalTemplateList.test.js +0 -422
- package/v2Components/SmsFallback/useLocalTemplateList.js +0 -92
- package/v2Components/TemplatePreview/constants.js +0 -2
- package/v2Components/VarSegmentMessageEditor/constants.js +0 -2
- package/v2Components/VarSegmentMessageEditor/index.js +0 -125
- package/v2Components/VarSegmentMessageEditor/index.scss +0 -46
- package/v2Containers/CreativesContainer/CreativesSlideBoxWrapper.js +0 -17
- package/v2Containers/CreativesContainer/embeddedSlideboxUtils.js +0 -79
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.localTemplates.test.js +0 -90
- package/v2Containers/CreativesContainer/tests/embeddedSlideboxUtils.test.js +0 -258
- package/v2Containers/CreativesContainer/tests/useLocalTemplatesProp.test.js +0 -125
- package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +0 -227
- package/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +0 -318
- package/v2Containers/Sms/smsFormDataHelpers.js +0 -67
- package/v2Containers/Sms/tests/smsFormDataHelpers.test.js +0 -253
- package/v2Containers/SmsTrai/Edit/index.scss +0 -126
- package/v2Containers/Templates/TemplatesActionBar.js +0 -101
- package/v2Containers/Templates/tests/TemplatesActionBar.test.js +0 -120
- package/v2Containers/Templates/tests/smsTemplatesListApi.test.js +0 -180
- package/v2Containers/Templates/utils/smsTemplatesListApi.js +0 -79
- package/v2Containers/TemplatesV2/tests/TemplatesV2.localTemplates.test.js +0 -131
|
@@ -8,7 +8,6 @@ import CapRow from '@capillarytech/cap-ui-library/CapRow';
|
|
|
8
8
|
import CapColumn from '@capillarytech/cap-ui-library/CapColumn';
|
|
9
9
|
import CapHeading from '@capillarytech/cap-ui-library/CapHeading';
|
|
10
10
|
import CapHeader from "@capillarytech/cap-ui-library/CapHeader";
|
|
11
|
-
import CapRadioGroup from '@capillarytech/cap-ui-library/CapRadioGroup';
|
|
12
11
|
import CapSelect from '@capillarytech/cap-ui-library/CapSelect';
|
|
13
12
|
import CapInput from '@capillarytech/cap-ui-library/CapInput';
|
|
14
13
|
import CapIcon from '@capillarytech/cap-ui-library/CapIcon';
|
|
@@ -21,16 +20,9 @@ import globalMessages from '../../v2Containers/Cap/messages';import CapTagListWi
|
|
|
21
20
|
|
|
22
21
|
import { isUrl, isValidText } from '../../v2Containers/Line/Container/Wrapper/utils';
|
|
23
22
|
import messages from './messages';
|
|
24
|
-
import {
|
|
25
|
-
BTN_MAX_LENGTH,
|
|
26
|
-
URL_MAX_LENGTH,
|
|
27
|
-
PHONE_NUMBER_MAX_LENGTH,
|
|
28
|
-
invalidVarRegex,
|
|
29
|
-
HANDLERS,
|
|
30
|
-
RCS_CTA_URL_TYPE,
|
|
31
|
-
} from './constants';
|
|
23
|
+
import { CTA_OPTIONS, BTN_MAX_LENGTH, URL_MAX_LENGTH, PHONE_NUMBER_MAX_LENGTH,invalidVarRegex, HANDLERS } from './constants';
|
|
32
24
|
import './index.scss';
|
|
33
|
-
import { INITIAL_SUGGESTIONS, RCS_BUTTON_TYPES
|
|
25
|
+
import { INITIAL_SUGGESTIONS, RCS_BUTTON_TYPES} from '../../v2Containers/Rcs/constants';
|
|
34
26
|
|
|
35
27
|
const { TextArea } = CapInput;
|
|
36
28
|
|
|
@@ -49,12 +41,9 @@ export const CapActionButton = (props) => {
|
|
|
49
41
|
injectedTags = {},
|
|
50
42
|
location = {},
|
|
51
43
|
selectedOfferDetails = [],
|
|
52
|
-
|
|
44
|
+
|
|
53
45
|
onContextChange,
|
|
54
|
-
minSavedSuggestions = 0,
|
|
55
|
-
hideDeleteSuggestionIndexes = [],
|
|
56
46
|
} = props;
|
|
57
|
-
const isHostIcs = host === HOST_ICS;
|
|
58
47
|
const [urlError, setUrlError] = useState(false);
|
|
59
48
|
const [buttonError, setButtonError] = useState(false);
|
|
60
49
|
const updateHandler = (type, value, index) => {
|
|
@@ -77,7 +66,6 @@ export const CapActionButton = (props) => {
|
|
|
77
66
|
|
|
78
67
|
const onCtaTypeChange = (value, index) => {
|
|
79
68
|
let clonedCta = cloneDeep(suggestions[index]);
|
|
80
|
-
const isCta = value === RCS_BUTTON_TYPES.CTA;
|
|
81
69
|
clonedCta = {
|
|
82
70
|
...clonedCta,
|
|
83
71
|
type: value,
|
|
@@ -85,7 +73,6 @@ export const CapActionButton = (props) => {
|
|
|
85
73
|
phoneNumber: '',
|
|
86
74
|
postback: '',
|
|
87
75
|
url: value === RCS_BUTTON_TYPES.PHONE_NUMBER ? null : '',
|
|
88
|
-
urlType: isCta ? RCS_CTA_URL_TYPE.STATIC : undefined,
|
|
89
76
|
isSaved: false,
|
|
90
77
|
};
|
|
91
78
|
setUrlError(false);
|
|
@@ -97,7 +84,7 @@ export const CapActionButton = (props) => {
|
|
|
97
84
|
const { value, id } = target;
|
|
98
85
|
let errorMessage = '';
|
|
99
86
|
if (value.length > BTN_MAX_LENGTH) {
|
|
100
|
-
errorMessage = formatMessage(messages.ctaButtonTextLengthError
|
|
87
|
+
errorMessage = formatMessage(messages.ctaButtonTextLengthError);
|
|
101
88
|
} if (!isValidText(value)) {
|
|
102
89
|
errorMessage = formatMessage(messages.ctaButtonErrorMessage);
|
|
103
90
|
}
|
|
@@ -105,61 +92,39 @@ export const CapActionButton = (props) => {
|
|
|
105
92
|
updateDisplayAndPostback(value, id);
|
|
106
93
|
};
|
|
107
94
|
|
|
108
|
-
const
|
|
109
|
-
<CapHeading type="
|
|
110
|
-
{formatMessage(messages.
|
|
95
|
+
const renderLength = (len, max) => (
|
|
96
|
+
<CapHeading type="label1" className="rcs-render-btn-length">
|
|
97
|
+
{formatMessage(messages.templateMessageLength, {
|
|
98
|
+
currentLength: len,
|
|
99
|
+
maxLength: max,
|
|
100
|
+
})}
|
|
111
101
|
</CapHeading>
|
|
112
102
|
);
|
|
113
103
|
|
|
114
|
-
const validateCtaUrlValue = (value, urlSubtype) => {
|
|
115
|
-
const v = String(value || '').trim();
|
|
116
|
-
if (!v) {
|
|
117
|
-
return formatMessage(messages.ctaWebsiteUrlErrorMessage);
|
|
118
|
-
}
|
|
119
|
-
if (v.length > URL_MAX_LENGTH) {
|
|
120
|
-
return formatMessage(messages.ctaWebsiteUrlErrorMessage);
|
|
121
|
-
}
|
|
122
|
-
if (urlSubtype === RCS_CTA_URL_TYPE.DYNAMIC) {
|
|
123
|
-
return false;
|
|
124
|
-
}
|
|
125
|
-
if (!isUrl(v)) {
|
|
126
|
-
return formatMessage(messages.ctaWebsiteUrlErrorMessage);
|
|
127
|
-
}
|
|
128
|
-
if (v.match(invalidVarRegex)?.length > 0) {
|
|
129
|
-
return formatMessage(messages.staticUrlWithVarErrorMessage);
|
|
130
|
-
}
|
|
131
|
-
return false;
|
|
132
|
-
};
|
|
133
|
-
|
|
134
104
|
const onUrlChange = ({ target }) => {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
105
|
+
let { value, id } = target;
|
|
106
|
+
let errorMessage = false;
|
|
107
|
+
if (!isUrl(value)) {
|
|
108
|
+
errorMessage = formatMessage(messages.ctaWebsiteUrlErrorMessage);
|
|
109
|
+
} else if (value.match(invalidVarRegex)?.length > 0) {
|
|
110
|
+
errorMessage = formatMessage(messages.staticUrlWithVarErrorMessage);
|
|
111
|
+
}
|
|
112
|
+
setUrlError(errorMessage);
|
|
139
113
|
updateHandler(HANDLERS.URL, value, id);
|
|
140
114
|
};
|
|
141
115
|
|
|
142
|
-
const onUrlSubtypeChange = (nextSubtype, index) => {
|
|
143
|
-
const cloned = cloneDeep(suggestions[index]);
|
|
144
|
-
cloned.urlType = nextSubtype;
|
|
145
|
-
cloned.isSaved = false;
|
|
146
|
-
setUrlError(validateCtaUrlValue(cloned.url || '', nextSubtype));
|
|
147
|
-
updateButtonChange(cloned, index);
|
|
148
|
-
};
|
|
149
|
-
|
|
150
116
|
const onPhoneNoChange = (value, index) => {
|
|
151
117
|
updateHandler(HANDLERS.PHONE_NUMBER, value, index);
|
|
152
118
|
};
|
|
153
119
|
|
|
154
120
|
const ctaSaveDisabled = (index) => {
|
|
155
|
-
const { type, text, phoneNumber, url
|
|
121
|
+
const { type, text, phoneNumber, url } = suggestions[index] || {};
|
|
156
122
|
if (text === '' || buttonError) {
|
|
157
123
|
return true;
|
|
158
|
-
} if (type === RCS_BUTTON_TYPES.PHONE_NUMBER &&
|
|
124
|
+
} if (type === RCS_BUTTON_TYPES.PHONE_NUMBER && phoneNumber.length < 5) {
|
|
125
|
+
return true;
|
|
126
|
+
} if (type === RCS_BUTTON_TYPES.CTA && (url === '' || urlError)) {
|
|
159
127
|
return true;
|
|
160
|
-
} if (type === RCS_BUTTON_TYPES.CTA) {
|
|
161
|
-
const subtype = urlType || RCS_CTA_URL_TYPE.STATIC;
|
|
162
|
-
return !!validateCtaUrlValue(url, subtype);
|
|
163
128
|
}
|
|
164
129
|
return false;
|
|
165
130
|
};
|
|
@@ -178,59 +143,64 @@ export const CapActionButton = (props) => {
|
|
|
178
143
|
updateButtonChange(newSuggestion, suggestions?.length);
|
|
179
144
|
};
|
|
180
145
|
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
146
|
+
const renderCtaOptions = (label, tooltipLabel, isDisabled) => {
|
|
147
|
+
if (isDisabled) {
|
|
148
|
+
return (
|
|
149
|
+
<CapRow>
|
|
150
|
+
<CapColumn span={23}>{label}</CapColumn>
|
|
151
|
+
<CapColumn span={1}>
|
|
152
|
+
<CapTooltipWithInfo
|
|
153
|
+
// autoAdjustOverflow
|
|
154
|
+
placement="right"
|
|
155
|
+
title={tooltipLabel}
|
|
156
|
+
/>
|
|
157
|
+
</CapColumn>
|
|
158
|
+
</CapRow>
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
return label;
|
|
162
|
+
};
|
|
196
163
|
|
|
164
|
+
const { formatMessage } = intl;
|
|
197
165
|
const renderedContent = () => {
|
|
198
166
|
const renderArray = [];
|
|
199
|
-
const addBtnDisabled = suggestions
|
|
200
|
-
|
|
201
|
-
const
|
|
202
|
-
const
|
|
203
|
-
|
|
204
|
-
return
|
|
205
|
-
|
|
167
|
+
const addBtnDisabled = suggestions.length >= maxButtons || !suggestions[suggestions.length - 1]?.isSaved;
|
|
168
|
+
|
|
169
|
+
const ctaOptions = CTA_OPTIONS.map((option) => {
|
|
170
|
+
const { value, label } = option;
|
|
171
|
+
const isDisabled = suggestions.length >= maxButtons && !suggestions[suggestions.length - 1];
|
|
172
|
+
return {
|
|
173
|
+
value,
|
|
174
|
+
label: renderCtaOptions(label, formatMessage(messages.ctaButtonTypeDisabled), isDisabled),
|
|
175
|
+
disabled: isDisabled,
|
|
176
|
+
};
|
|
177
|
+
});
|
|
206
178
|
|
|
207
|
-
suggestions
|
|
179
|
+
suggestions.forEach((cta) => {
|
|
208
180
|
const {
|
|
209
181
|
index, type, text, isSaved,
|
|
210
182
|
} = cta || {};
|
|
211
183
|
|
|
212
184
|
const url = type !== RCS_BUTTON_TYPES.CTA ? null : cta.url;
|
|
213
|
-
const urlSubtype = type === RCS_BUTTON_TYPES.CTA
|
|
214
|
-
? (cta.urlType || RCS_CTA_URL_TYPE.STATIC)
|
|
215
|
-
: RCS_CTA_URL_TYPE.STATIC;
|
|
216
185
|
const phoneNumber = type !== RCS_BUTTON_TYPES.PHONE_NUMBER ? null : cta.phoneNumber;
|
|
217
186
|
if (isFullMode && !isEditFlow && !isSaved) {
|
|
218
187
|
renderArray.push(
|
|
219
|
-
<
|
|
220
|
-
<CapRow className="rcs-button-cta-create"
|
|
221
|
-
<CapColumn span={
|
|
222
|
-
|
|
188
|
+
<div className="rcs-button-cta-create-container" key={`cta-edit-${index}`}>
|
|
189
|
+
<CapRow type='flex' justify='space-between' className="rcs-button-cta-create margin-t-16">
|
|
190
|
+
<CapColumn span={11}>
|
|
191
|
+
{/* Type of action */}
|
|
192
|
+
<CapHeading type="h4" className="cta-label">
|
|
223
193
|
{formatMessage(messages.ctaType)}
|
|
224
194
|
</CapHeading>
|
|
225
|
-
<
|
|
226
|
-
id=
|
|
227
|
-
|
|
228
|
-
|
|
195
|
+
<CapSelect
|
|
196
|
+
id="rcs-cta-type"
|
|
197
|
+
options={ctaOptions || []}
|
|
198
|
+
onChange={(value) => onCtaTypeChange(value, index)}
|
|
229
199
|
value={type}
|
|
230
|
-
|
|
200
|
+
disabled={false}
|
|
231
201
|
/>
|
|
232
202
|
</CapColumn>
|
|
233
|
-
<CapColumn span={
|
|
203
|
+
<CapColumn span={12}>
|
|
234
204
|
<CapHeading type="h4" className="cta-label">
|
|
235
205
|
{formatMessage(messages.ctaButtonText)}
|
|
236
206
|
<CapTooltipWithInfo
|
|
@@ -251,34 +221,28 @@ export const CapActionButton = (props) => {
|
|
|
251
221
|
size="large"
|
|
252
222
|
maxLength={BTN_MAX_LENGTH}
|
|
253
223
|
errorMessage={buttonError}
|
|
254
|
-
suffix={renderInnerCharCount((text || '').length, BTN_MAX_LENGTH)}
|
|
255
224
|
/>
|
|
225
|
+
{renderLength(text.length, BTN_MAX_LENGTH)}
|
|
256
226
|
</CapColumn>
|
|
257
227
|
</CapRow>
|
|
258
228
|
{type === RCS_BUTTON_TYPES.PHONE_NUMBER && (
|
|
259
229
|
<>
|
|
260
230
|
<CapRow>
|
|
261
|
-
<CapColumn span={
|
|
231
|
+
<CapColumn span={11}>
|
|
232
|
+
{/* phone number */}
|
|
262
233
|
<CapHeading type="h4" className="cta-label">
|
|
263
234
|
{formatMessage(messages.ctaPhoneNo)}
|
|
264
235
|
</CapHeading>
|
|
265
|
-
<
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
onChange={(value) => onPhoneNoChange(value, index)}
|
|
276
|
-
country="in"
|
|
277
|
-
className="cta-phone-number rcs-cta-phone-input"
|
|
278
|
-
/>
|
|
279
|
-
{renderInnerCharCount((phoneNumber || '').length, PHONE_NUMBER_MAX_LENGTH)}
|
|
280
|
-
</CapColumn>
|
|
281
|
-
</CapRow>
|
|
236
|
+
<PhoneInput
|
|
237
|
+
placeholder={formatMessage(messages.ctaPhoneNoPlaceholder)}
|
|
238
|
+
autoFormat={false}
|
|
239
|
+
countryCodeEditable={false}
|
|
240
|
+
value={phoneNumber}
|
|
241
|
+
onChange={(value) => onPhoneNoChange(value, index)}
|
|
242
|
+
country="in"
|
|
243
|
+
className="cta-phone-number"
|
|
244
|
+
/>
|
|
245
|
+
{renderLength(phoneNumber.length, PHONE_NUMBER_MAX_LENGTH)}
|
|
282
246
|
</CapColumn>
|
|
283
247
|
</CapRow>
|
|
284
248
|
<CapRow useLegacy className="rcs-cta-save-delete-btn">
|
|
@@ -286,7 +250,7 @@ export const CapActionButton = (props) => {
|
|
|
286
250
|
title={ctaSaveDisabled(index) && formatMessage(messages.ctaSaveDisabled)}
|
|
287
251
|
placement="bottom"
|
|
288
252
|
>
|
|
289
|
-
<
|
|
253
|
+
<div className="button-disabled-tooltip-wrapper">
|
|
290
254
|
<CapButton
|
|
291
255
|
onClick={() => saveCta(index)}
|
|
292
256
|
disabled={ctaSaveDisabled(index)}
|
|
@@ -294,49 +258,36 @@ export const CapActionButton = (props) => {
|
|
|
294
258
|
>
|
|
295
259
|
{formatMessage(globalMessages.save)}
|
|
296
260
|
</CapButton>
|
|
297
|
-
</
|
|
261
|
+
</div>
|
|
298
262
|
</CapTooltip>
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
</CapButton>
|
|
307
|
-
)}
|
|
263
|
+
<CapButton
|
|
264
|
+
onClick={() => deleteButtonHandler(index)}
|
|
265
|
+
className="rcs-cta-delete-btn"
|
|
266
|
+
type="secondary"
|
|
267
|
+
>
|
|
268
|
+
{formatMessage(globalMessages.delete)}
|
|
269
|
+
</CapButton>
|
|
308
270
|
</CapRow>
|
|
309
271
|
</>
|
|
310
272
|
)}
|
|
311
273
|
{type === RCS_BUTTON_TYPES.CTA && (
|
|
312
274
|
<>
|
|
313
|
-
<CapRow
|
|
314
|
-
<CapColumn span={
|
|
315
|
-
<CapHeading type="h4" className="cta-label">
|
|
316
|
-
{formatMessage(messages.ctaWebsiteType)}
|
|
317
|
-
</CapHeading>
|
|
318
|
-
<CapSelect
|
|
319
|
-
id={`rcs-cta-url-type-${index}`}
|
|
320
|
-
options={urlTypeSelectOptions}
|
|
321
|
-
value={urlSubtype}
|
|
322
|
-
onChange={(value) => onUrlSubtypeChange(value, index)}
|
|
323
|
-
/>
|
|
324
|
-
</CapColumn>
|
|
325
|
-
<CapColumn span={18} className="rcs-cta-url-value-col">
|
|
275
|
+
<CapRow>
|
|
276
|
+
<CapColumn span={24}>
|
|
326
277
|
<CapHeading type="h4" className="cta-label">
|
|
327
|
-
{formatMessage(messages.
|
|
278
|
+
{formatMessage(messages.ctaWebsite)}
|
|
328
279
|
</CapHeading>
|
|
329
280
|
<CapInput
|
|
330
281
|
id={index}
|
|
331
282
|
className="rcs-cta-url"
|
|
332
283
|
onChange={onUrlChange}
|
|
333
|
-
placeholder={formatMessage(messages.
|
|
334
|
-
value={url
|
|
284
|
+
placeholder={formatMessage(messages.ctaStaticPlaceholder)}
|
|
285
|
+
value={url}
|
|
335
286
|
size="large"
|
|
336
287
|
maxLength={URL_MAX_LENGTH}
|
|
337
288
|
errorMessage={urlError}
|
|
338
|
-
suffix={renderInnerCharCount((url || '').length, URL_MAX_LENGTH)}
|
|
339
289
|
/>
|
|
290
|
+
{renderLength(url.length, URL_MAX_LENGTH)}
|
|
340
291
|
</CapColumn>
|
|
341
292
|
</CapRow>
|
|
342
293
|
<CapRow useLegacy className="rcs-cta-save-delete-btn">
|
|
@@ -346,7 +297,7 @@ export const CapActionButton = (props) => {
|
|
|
346
297
|
}
|
|
347
298
|
placement="bottom"
|
|
348
299
|
>
|
|
349
|
-
<
|
|
300
|
+
<div className="button-disabled-tooltip-wrapper">
|
|
350
301
|
<CapButton
|
|
351
302
|
onClick={() => saveCta(index)}
|
|
352
303
|
disabled={ctaSaveDisabled(index)}
|
|
@@ -354,17 +305,15 @@ export const CapActionButton = (props) => {
|
|
|
354
305
|
>
|
|
355
306
|
{formatMessage(globalMessages.save)}
|
|
356
307
|
</CapButton>
|
|
357
|
-
</
|
|
308
|
+
</div>
|
|
358
309
|
</CapTooltip>
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
</CapButton>
|
|
367
|
-
)}
|
|
310
|
+
<CapButton
|
|
311
|
+
onClick={() => deleteButtonHandler(index)}
|
|
312
|
+
className="rcs-cta-delete-btn"
|
|
313
|
+
type="secondary"
|
|
314
|
+
>
|
|
315
|
+
{formatMessage(globalMessages.delete)}
|
|
316
|
+
</CapButton>
|
|
368
317
|
</CapRow>
|
|
369
318
|
</>
|
|
370
319
|
)}
|
|
@@ -374,7 +323,7 @@ export const CapActionButton = (props) => {
|
|
|
374
323
|
title={ctaSaveDisabled(index) && formatMessage(messages.ctaSaveDisabled)}
|
|
375
324
|
placement="bottom"
|
|
376
325
|
>
|
|
377
|
-
<
|
|
326
|
+
<div className="button-disabled-tooltip-wrapper">
|
|
378
327
|
<CapButton
|
|
379
328
|
onClick={() => saveCta(index)}
|
|
380
329
|
disabled={ctaSaveDisabled(index)}
|
|
@@ -382,9 +331,9 @@ export const CapActionButton = (props) => {
|
|
|
382
331
|
>
|
|
383
332
|
{formatMessage(globalMessages.save)}
|
|
384
333
|
</CapButton>
|
|
385
|
-
</
|
|
334
|
+
</div>
|
|
386
335
|
</CapTooltip>
|
|
387
|
-
{
|
|
336
|
+
{index !== 0 && (
|
|
388
337
|
<CapButton
|
|
389
338
|
onClick={() => deleteButtonHandler(index)}
|
|
390
339
|
className="rcs-cta-delete-btn"
|
|
@@ -395,24 +344,23 @@ export const CapActionButton = (props) => {
|
|
|
395
344
|
)}
|
|
396
345
|
</CapRow>
|
|
397
346
|
)}
|
|
398
|
-
</
|
|
347
|
+
</div>
|
|
399
348
|
);
|
|
400
349
|
} else {
|
|
401
350
|
const ctaIsPhone = type === RCS_BUTTON_TYPES.PHONE_NUMBER;
|
|
402
351
|
const ctaIsReply = type === RCS_BUTTON_TYPES.QUICK_REPLY;
|
|
403
|
-
|
|
352
|
+
renderArray.push(
|
|
404
353
|
<CapRow
|
|
405
354
|
key={`cta-saved-${index}`}
|
|
406
355
|
className="cap-rcs-saved-cta margin-t-12"
|
|
407
356
|
align="middle"
|
|
408
357
|
type="flex"
|
|
409
|
-
gutter={9}
|
|
410
358
|
>
|
|
411
359
|
<CapColumn
|
|
412
360
|
span={1}
|
|
413
361
|
className={`${ctaIsPhone ? 'whatsapp-saved-cta-phone-icon' : ''}`}
|
|
414
362
|
>
|
|
415
|
-
<CapIcon size="s" type={ctaIsPhone ? 'call' :
|
|
363
|
+
<CapIcon size="s" type={ctaIsPhone ? 'call' : 'launch'} />
|
|
416
364
|
</CapColumn>
|
|
417
365
|
<CapColumn span={6}>
|
|
418
366
|
<CapLabel
|
|
@@ -422,49 +370,49 @@ export const CapActionButton = (props) => {
|
|
|
422
370
|
{text}
|
|
423
371
|
</CapLabel>
|
|
424
372
|
</CapColumn>
|
|
425
|
-
|
|
426
|
-
<
|
|
427
|
-
{
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
373
|
+
{ctaIsPhone && (
|
|
374
|
+
<CapColumn span={10} align="left">
|
|
375
|
+
<CapLabel className="phone">+{phoneNumber}</CapLabel>
|
|
376
|
+
</CapColumn>
|
|
377
|
+
)}
|
|
378
|
+
{!ctaIsPhone && !ctaIsReply && (
|
|
379
|
+
<>
|
|
380
|
+
<CapColumn span={3}>
|
|
381
|
+
<CapLabel className="url-type" type="label2">
|
|
382
|
+
{formatMessage(messages.ctaWebsiteTypeStatic)}
|
|
383
|
+
</CapLabel>
|
|
384
|
+
</CapColumn>
|
|
385
|
+
<CapRow type='flex' className="rcs-url-preview-wrapper">
|
|
386
|
+
<CapTooltip title={url} placement="top">
|
|
387
|
+
<CapColumn span={14} className="margin-r-0">
|
|
438
388
|
<CapLabel className="url">{url}</CapLabel>
|
|
439
|
-
</
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
)}
|
|
458
|
-
</div>
|
|
389
|
+
</CapColumn>
|
|
390
|
+
</CapTooltip>
|
|
391
|
+
</CapRow>
|
|
392
|
+
</>
|
|
393
|
+
)}
|
|
394
|
+
{(isFullMode && !isEditFlow) && (
|
|
395
|
+
<>
|
|
396
|
+
<CapColumn
|
|
397
|
+
span={1}
|
|
398
|
+
className="rcs-saved-cta-edit-icon"
|
|
399
|
+
onClick={() => editCta(index)}
|
|
400
|
+
>
|
|
401
|
+
<CapIcon size="s" type="edit" />
|
|
402
|
+
</CapColumn>
|
|
403
|
+
{index !== 0 && (
|
|
404
|
+
<CapColumn className="rcs-saved-cta-delete-icon" span={1} onClick={() => deleteButtonHandler(index)}>
|
|
405
|
+
<CapIcon size="s" type="delete" />
|
|
406
|
+
</CapColumn>
|
|
459
407
|
)}
|
|
460
|
-
|
|
461
|
-
|
|
408
|
+
</>
|
|
409
|
+
)}
|
|
462
410
|
</CapRow>
|
|
463
411
|
);
|
|
464
412
|
}
|
|
465
413
|
});
|
|
466
414
|
{
|
|
467
|
-
suggestions
|
|
415
|
+
suggestions.length < maxButtons &&
|
|
468
416
|
(isFullMode && !isEditFlow)
|
|
469
417
|
&& renderArray.push(
|
|
470
418
|
<CapRow useLegacy>
|
|
@@ -474,7 +422,7 @@ export const CapActionButton = (props) => {
|
|
|
474
422
|
}
|
|
475
423
|
placement={'right'}
|
|
476
424
|
>
|
|
477
|
-
<
|
|
425
|
+
<div className="button-disabled-tooltip-wrapper">
|
|
478
426
|
<CapButton
|
|
479
427
|
type="flat"
|
|
480
428
|
id="rcs-cta-add-button"
|
|
@@ -485,7 +433,7 @@ export const CapActionButton = (props) => {
|
|
|
485
433
|
>
|
|
486
434
|
{formatMessage(messages.addButton)}
|
|
487
435
|
</CapButton>
|
|
488
|
-
</
|
|
436
|
+
</div>
|
|
489
437
|
</CapTooltip>
|
|
490
438
|
</CapRow>,
|
|
491
439
|
);
|
|
@@ -498,8 +446,6 @@ export const CapActionButton = (props) => {
|
|
|
498
446
|
CapActionButton.propTypes = {
|
|
499
447
|
intl: intlShape.isRequired,
|
|
500
448
|
updateButtonChange: PropTypes.func,
|
|
501
|
-
minSavedSuggestions: PropTypes.number,
|
|
502
|
-
hideDeleteSuggestionIndexes: PropTypes.arrayOf(PropTypes.number),
|
|
503
449
|
suggestions: PropTypes.array,
|
|
504
450
|
tags: PropTypes.array,
|
|
505
451
|
injectedTags: PropTypes.object,
|
|
@@ -507,15 +453,12 @@ CapActionButton.propTypes = {
|
|
|
507
453
|
selectedOfferDetails: PropTypes.array,
|
|
508
454
|
onTagSelect: PropTypes.func,
|
|
509
455
|
onContextChange: PropTypes.func,
|
|
510
|
-
host: PropTypes.string,
|
|
511
456
|
};
|
|
512
457
|
|
|
513
458
|
CapActionButton.defaultProps = {
|
|
514
459
|
buttonTextlen: 20,
|
|
515
460
|
type: '',
|
|
516
461
|
updateButtonChange: () => {},
|
|
517
|
-
minSavedSuggestions: 0,
|
|
518
|
-
hideDeleteSuggestionIndexes: [],
|
|
519
462
|
suggestions: [],
|
|
520
463
|
tags: [],
|
|
521
464
|
injectedTags: {},
|
|
@@ -523,7 +466,6 @@ CapActionButton.defaultProps = {
|
|
|
523
466
|
selectedOfferDetails: [],
|
|
524
467
|
onTagSelect: () => {},
|
|
525
468
|
onContextChange: () => {},
|
|
526
|
-
host: '',
|
|
527
469
|
};
|
|
528
470
|
|
|
529
471
|
export default injectIntl(CapActionButton);
|