@capillarytech/creatives-library 9.2.2-alpha.sprint-cap-214249.44 → 9.2.2
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/constants/unified.js +1 -3
- package/package.json +1 -1
- package/translations/en.json +0 -1
- package/translations/ja-JP.json +0 -1
- package/translations/zh.json +0 -1
- package/utils/common.js +6 -0
- package/utils/createMobilePushPayload.js +56 -50
- package/utils/tagValidations.js +4 -35
- package/utils/tests/createMobilePushPayload.test.js +168 -177
- package/utils/tests/tagValidations.test.js +0 -48
- package/v2Components/CapMpushCTA/index.js +57 -47
- package/v2Components/CapMpushCTA/index.scss +5 -43
- package/v2Components/CapTagList/index.js +7 -46
- package/v2Components/CapTagList/messages.js +0 -44
- package/v2Components/CapTagList/style.scss +1 -113
- package/v2Components/CommonTestAndPreview/UnifiedPreview/MobilePushPreviewContent.js +8 -11
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +1 -13
- package/v2Components/CommonTestAndPreview/constants.js +0 -2
- package/v2Components/CommonTestAndPreview/index.js +12 -51
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/MobilePushPreviewContent.test.js +5 -83
- package/v2Components/CommonTestAndPreview/tests/index.test.js +0 -100
- package/v2Components/FormBuilder/Classic.js +14 -24
- package/v2Components/FormBuilder/Functional/channels/mobilepush/config.js +0 -1
- package/v2Components/FormBuilder/Functional/channels/mobilepush/getEditorErrorDescriptor.js +1 -1
- package/v2Components/FormBuilder/Functional/channels/mobilepush/tests/validate.test.js +0 -57
- package/v2Components/FormBuilder/Functional/channels/mobilepush/validate.js +4 -4
- package/v2Components/FormBuilder/Functional/channels/sms/getEditorErrorDescriptor.js +0 -3
- package/v2Components/FormBuilder/Functional/channels/sms/tests/getEditorErrorDescriptor.test.js +0 -5
- package/v2Components/FormBuilder/Functional/channels/sms/tests/validate.test.js +0 -6
- package/v2Components/FormBuilder/Functional/channels/sms/validate.js +1 -3
- package/v2Components/FormBuilder/Functional/renderers/mpushRenderers.js +0 -3
- package/v2Components/FormBuilder/Functional/tests/mpushRenderers.test.js +0 -22
- package/v2Components/MobilePushPreviewV2/index.js +9 -22
- package/v2Components/TemplatePreview/_templatePreview.scss +2 -18
- package/v2Components/TemplatePreview/index.js +18 -20
- package/v2Components/TemplatePreview/tests/index.test.js +0 -69
- package/v2Containers/Cap/messages.js +0 -4
- package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +0 -1
- package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/extractContentForPreview.js +2 -12
- package/v2Containers/CreativesContainer/SlideBoxContent.js +6 -4
- package/v2Containers/CreativesContainer/index.js +1 -2
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +0 -43
- package/v2Containers/InApp/index.js +1 -4
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +0 -3
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +0 -2
- package/v2Containers/Line/Container/Text/index.js +1 -3
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +0 -16
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +0 -18
- package/v2Containers/MobilePushNew/components/CtaButtons.js +47 -52
- package/v2Containers/MobilePushNew/components/MediaUploaders.js +345 -105
- package/v2Containers/MobilePushNew/components/PlatformContentFields.js +105 -127
- package/v2Containers/MobilePushNew/components/tests/CtaButtons.test.js +208 -30
- package/v2Containers/MobilePushNew/components/tests/MediaUploaders.test.js +1484 -307
- package/v2Containers/MobilePushNew/components/tests/PlatformContentFields.test.js +59 -165
- package/v2Containers/MobilePushNew/constants.js +0 -12
- package/v2Containers/MobilePushNew/hooks/tests/usePlatformSync.test.js +1 -63
- package/v2Containers/MobilePushNew/hooks/tests/useUpload.test.js +0 -78
- package/v2Containers/MobilePushNew/hooks/usePlatformSync.js +1 -40
- package/v2Containers/MobilePushNew/hooks/useUpload.js +46 -42
- package/v2Containers/MobilePushNew/index.js +290 -502
- package/v2Containers/MobilePushNew/index.scss +4 -151
- package/v2Containers/MobilePushNew/messages.js +6 -106
- package/v2Containers/MobilePushNew/tests/index.test.js +1 -483
- package/v2Containers/MobilePushNew/tests/utils.test.js +0 -110
- package/v2Containers/MobilePushNew/utils.js +0 -83
- package/v2Containers/Rcs/index.js +1 -8
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +0 -59
- package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +0 -4
- package/v2Containers/SmsTrai/Edit/index.js +5 -13
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +0 -15
- package/v2Containers/Templates/_templates.scss +2 -10
- package/v2Containers/Templates/index.js +81 -86
- package/v2Containers/Templates/tests/index.test.js +0 -81
- package/v2Containers/Viber/index.js +1 -3
- package/v2Containers/WebPush/Create/utils/validation.js +0 -6
- package/v2Containers/WebPush/Create/utils/validation.test.js +0 -50
- package/v2Containers/Whatsapp/index.js +5 -9
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +2 -2
- package/v2Containers/Zalo/index.js +1 -4
- package/v2Components/CapMpushCTA/tests/index.test.js +0 -150
- package/v2Components/CapTagList/TagFallbackPanel.js +0 -124
- package/v2Components/CapTagList/constants.js +0 -5
- package/v2Components/CapTagList/tests/TagFallback.test.js +0 -222
- package/v2Components/CapTagList/utils.js +0 -17
- package/v2Components/MobilePushPreviewV2/_mobilePushPreviewV2.scss +0 -7
- package/v2Components/MobilePushPreviewV2/tests/index.test.js +0 -55
- package/v2Components/TemplatePreview/_mobilePushPhone.scss +0 -72
- package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/Tests/extractContentForPreview.test.js +0 -45
- package/v2Containers/MobilePushNew/components/TapLinkActions.js +0 -76
|
@@ -20,9 +20,7 @@ import {
|
|
|
20
20
|
isUrl,
|
|
21
21
|
isValidText,
|
|
22
22
|
} from "../../v2Containers/Line/Container/Wrapper/utils";
|
|
23
|
-
import {
|
|
24
|
-
isDeepLink, getDeepLinkParamValue, setDeepLinkParamValue, hasAllDeepLinkParams,
|
|
25
|
-
} from "../../v2Containers/MobilePushNew/utils";
|
|
23
|
+
import { isDeepLink } from "../../v2Containers/MobilePushNew/utils";
|
|
26
24
|
import {
|
|
27
25
|
BTN_MAX_LENGTH,
|
|
28
26
|
DEEP_LINK,
|
|
@@ -54,9 +52,8 @@ export const CapMpushCTA = (props) => {
|
|
|
54
52
|
const [urlError, setUrlError] = useState(false);
|
|
55
53
|
const [buttonError, setButtonError] = useState(false);
|
|
56
54
|
const [deepLinkKeysError, setDeepLinkKeysError] = useState(false);
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
const ctaDeepLinkKeysValue = ctaData[0]?.deepLinkKeys || [];
|
|
55
|
+
const [ctaDeepLinkValue, setCtaDeepLinkValue] = useState(ctaData[0]?.url || "");
|
|
56
|
+
const [ctaDeepLinkKeysValue, setCtaDeepLinkKeysValue] = useState(ctaData[0]?.deepLinkKeys || []);
|
|
60
57
|
const [localUrlValues, setLocalUrlValues] = useState({});
|
|
61
58
|
// Track which URLs have been manually cleared to prevent restoration
|
|
62
59
|
const clearedUrlsRef = useRef(new Set());
|
|
@@ -136,16 +133,21 @@ export const CapMpushCTA = (props) => {
|
|
|
136
133
|
// Mark this URL as manually cleared to prevent restoration
|
|
137
134
|
clearedUrlsRef.current.add(index);
|
|
138
135
|
|
|
136
|
+
// Clear the URL field when switching between link types
|
|
137
|
+
updateHelper('url', '', index);
|
|
138
|
+
|
|
139
139
|
// Immediately clear the local URL state for this button
|
|
140
140
|
setLocalUrlValues(prev => ({
|
|
141
141
|
...prev,
|
|
142
142
|
[index]: ''
|
|
143
143
|
}));
|
|
144
144
|
|
|
145
|
+
// Also clear the local deep link state
|
|
146
|
+
setCtaDeepLinkValue('');
|
|
145
147
|
// Clear any URL errors
|
|
146
148
|
setUrlError(false);
|
|
147
|
-
//
|
|
148
|
-
|
|
149
|
+
// Update the URL type
|
|
150
|
+
updateHelper('urlType', value, index);
|
|
149
151
|
};
|
|
150
152
|
|
|
151
153
|
const onUrlChange = ({ target }) => {
|
|
@@ -173,6 +175,7 @@ export const CapMpushCTA = (props) => {
|
|
|
173
175
|
};
|
|
174
176
|
|
|
175
177
|
const onDeepLinkSelect = (value, index) => {
|
|
178
|
+
setCtaDeepLinkValue(value);
|
|
176
179
|
let errorMessage = false;
|
|
177
180
|
if (!isDeepLink(value)) {
|
|
178
181
|
errorMessage = formatMessage(messages.ctaWebsiteUrlErrorMessage);
|
|
@@ -181,10 +184,13 @@ export const CapMpushCTA = (props) => {
|
|
|
181
184
|
updateHelper('url', value, index);
|
|
182
185
|
};
|
|
183
186
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
const
|
|
187
|
-
|
|
187
|
+
const onDeepLinkKeysChange = ({ target }) => {
|
|
188
|
+
const { value, dataset } = target;
|
|
189
|
+
const index = parseInt(dataset.index, 10);
|
|
190
|
+
// Parse comma-separated values into array
|
|
191
|
+
const keysArray = value?.split(',')?.map((key) => key?.trim())?.filter((key) => key?.length > 0);
|
|
192
|
+
setCtaDeepLinkKeysValue(keysArray);
|
|
193
|
+
setDeepLinkKeysError(keysArray.length === 0);
|
|
188
194
|
updateHelper('deepLinkKeys', keysArray, index);
|
|
189
195
|
};
|
|
190
196
|
|
|
@@ -194,7 +200,7 @@ export const CapMpushCTA = (props) => {
|
|
|
194
200
|
return true;
|
|
195
201
|
} else if (urlType === DEEP_LINK && (ctaDeepLinkValue === "" || urlError)) {
|
|
196
202
|
return true;
|
|
197
|
-
} else if (urlType === DEEP_LINK && ctaDeepLinkValue && deepLinkKeysFromSelectionArray?.length > 0 && (!
|
|
203
|
+
} else if (urlType === DEEP_LINK && ctaDeepLinkValue && deepLinkKeysFromSelectionArray?.length > 0 && (!Array.isArray(ctaDeepLinkKeysValue) || ctaDeepLinkKeysValue?.length === 0 || deepLinkKeysError)) {
|
|
198
204
|
return true;
|
|
199
205
|
} else if (urlType === EXTERNAL_URL && (url === "" || urlError)) {
|
|
200
206
|
return true;
|
|
@@ -229,10 +235,9 @@ export const CapMpushCTA = (props) => {
|
|
|
229
235
|
type="flex"
|
|
230
236
|
>
|
|
231
237
|
<CapColumn>
|
|
232
|
-
<CapRow
|
|
238
|
+
<CapRow className="mpush-cta-row">
|
|
233
239
|
<CapColumn>
|
|
234
|
-
|
|
235
|
-
<CapIcon size="s" type="open-in-new" />
|
|
240
|
+
<CapIcon size="s" type={'launch'} />
|
|
236
241
|
</CapColumn>
|
|
237
242
|
<CapColumn className="btn-text">
|
|
238
243
|
<CapLabel type="label2" className="mpush-saved-cta-button-text">
|
|
@@ -246,11 +251,13 @@ export const CapMpushCTA = (props) => {
|
|
|
246
251
|
<CapTag className="cta-type-label">{formatMessage(messages.urlDeepLink)}</CapTag>
|
|
247
252
|
: <CapTag className="cta-type-label">{formatMessage(messages.urlExternalLink)}</CapTag>}
|
|
248
253
|
</CapColumn>
|
|
249
|
-
<CapColumn
|
|
250
|
-
{urlType === DEEP_LINK ? selectedDeepLink?.label :
|
|
254
|
+
<CapColumn>
|
|
255
|
+
{urlType === DEEP_LINK ? selectedDeepLink?.label : ''}
|
|
256
|
+
</CapColumn>
|
|
257
|
+
<CapColumn>
|
|
251
258
|
</CapColumn>
|
|
252
259
|
<CapColumn>
|
|
253
|
-
<CapRow
|
|
260
|
+
<CapRow className="cta-action-grp">
|
|
254
261
|
<CapColumn
|
|
255
262
|
className="mpush-saved-cta-edit-icon"
|
|
256
263
|
onClick={() => isSavedCta(index, false)}
|
|
@@ -310,35 +317,9 @@ export const CapMpushCTA = (props) => {
|
|
|
310
317
|
onChange={(value) => onDeepLinkSelect(value, index)}
|
|
311
318
|
value={ctaDeepLinkValue}
|
|
312
319
|
/>
|
|
313
|
-
{/* Keys under the Deep link dropdown, as in Notification tap */}
|
|
314
|
-
{ctaDeepLinkValue && deepLinkKeysFromSelectionArray.length > 0 && (
|
|
315
|
-
<CapRow useLegacy className="mpush-cta-deep-link-keys">
|
|
316
|
-
<CapHeading type="h4">
|
|
317
|
-
{formatMessage(messages.deepLinkKeys)}
|
|
318
|
-
</CapHeading>
|
|
319
|
-
{deepLinkKeysFromSelectionArray.map((key, keyIndex) => (
|
|
320
|
-
<CapRow useLegacy key={key} className="mpush-deep-link-key">
|
|
321
|
-
<CapLabel type="label2" className="cta-deep-link-keys-value">
|
|
322
|
-
{key}
|
|
323
|
-
</CapLabel>
|
|
324
|
-
<CapInput
|
|
325
|
-
id={keyIndex === 0 ? "mpush-deep-link-keys" : `mpush-deep-link-keys-${keyIndex}`}
|
|
326
|
-
className="mpush-deep-link-keys"
|
|
327
|
-
onChange={({ target: { value } }) => onDeepLinkKeysChange(index, key, value)}
|
|
328
|
-
placeholder={formatMessage(messages.deepLinkKeysPlaceholder, { key })}
|
|
329
|
-
value={getDeepLinkParamValue(deepLinkKeysArray, key)}
|
|
330
|
-
data-index={index}
|
|
331
|
-
errorMessage={deepLinkKeysError && keyIndex === deepLinkKeysFromSelectionArray.length - 1 ? formatMessage(messages.deepLinkKeysRequired) : ""}
|
|
332
|
-
/>
|
|
333
|
-
</CapRow>
|
|
334
|
-
))}
|
|
335
|
-
</CapRow>
|
|
336
|
-
)}
|
|
337
320
|
</CapRow>
|
|
338
321
|
)}
|
|
339
322
|
{urlType === EXTERNAL_URL && (
|
|
340
|
-
// Wrapper lets the stylesheet size the label row to match "Type of link"
|
|
341
|
-
<CapRow className="mpush-cta-external-link-field">
|
|
342
323
|
<CapTagListWithInput
|
|
343
324
|
inputId="mpush-cta-external-link"
|
|
344
325
|
inputValue={localUrlValues[index] || ''}
|
|
@@ -348,7 +329,8 @@ export const CapMpushCTA = (props) => {
|
|
|
348
329
|
inputMaxLength={URL_MAX_LENGTH}
|
|
349
330
|
inputErrorMessage={urlError}
|
|
350
331
|
headingText={formatMessage(messages.urlExternalLink)}
|
|
351
|
-
headingStyle={{
|
|
332
|
+
headingStyle={{ marginTop: '3%', marginRight: '50%'}}
|
|
333
|
+
containerStyle={{ width: '70%', marginTop: '-0.625rem' }}
|
|
352
334
|
moduleFilterEnabled={location?.query?.type !== "embedded"}
|
|
353
335
|
onTagSelect={onButtonTagSelect}
|
|
354
336
|
onContextChange={handleOnTagsContextChange}
|
|
@@ -358,9 +340,37 @@ export const CapMpushCTA = (props) => {
|
|
|
358
340
|
selectedOfferDetails={selectedOfferDetails}
|
|
359
341
|
inputProps={{ 'data-index': index }}
|
|
360
342
|
/>
|
|
361
|
-
</CapRow>
|
|
362
343
|
)}
|
|
363
344
|
</CapColumn>
|
|
345
|
+
{urlType === DEEP_LINK && ctaDeepLinkValue && deepLinkKeysFromSelectionArray.length > 0 && (
|
|
346
|
+
<CapColumn>
|
|
347
|
+
<CapRow useLegacy style={{ marginTop: '10px' }}>
|
|
348
|
+
<CapHeading type="h4">
|
|
349
|
+
{formatMessage(messages.deepLinkKeys)}
|
|
350
|
+
</CapHeading>
|
|
351
|
+
<CapLabel type="label2" className="cta-deep-link-keys-value">
|
|
352
|
+
{(() => {
|
|
353
|
+
if (deepLinkKeysFromSelectionArray.length > 0) {
|
|
354
|
+
return deepLinkKeysFromSelectionArray.join(', ');
|
|
355
|
+
}
|
|
356
|
+
if (deepLinkKeysArray.length > 0) {
|
|
357
|
+
return deepLinkKeysArray.join(', ');
|
|
358
|
+
}
|
|
359
|
+
})()}
|
|
360
|
+
</CapLabel>
|
|
361
|
+
<CapInput
|
|
362
|
+
id="mpush-deep-link-keys"
|
|
363
|
+
className="mpush-deep-link-keys"
|
|
364
|
+
onChange={onDeepLinkKeysChange}
|
|
365
|
+
placeholder={formatMessage(messages.deepLinkKeysPlaceholder, { key: deepLinkKeysFromSelectionArray.join(', ') })}
|
|
366
|
+
value={Array.isArray(ctaDeepLinkKeysValue) ? ctaDeepLinkKeysValue.join(', ') : (ctaDeepLinkKeysValue || '')}
|
|
367
|
+
size="large"
|
|
368
|
+
data-index={index}
|
|
369
|
+
errorMessage={deepLinkKeysError ? formatMessage(messages.deepLinkKeysRequired) : ""}
|
|
370
|
+
/>
|
|
371
|
+
</CapRow>
|
|
372
|
+
</CapColumn>
|
|
373
|
+
)}
|
|
364
374
|
<CapColumn>
|
|
365
375
|
<CapRow useLegacy className="mpush-cta-save-delete-btn">
|
|
366
376
|
<CapTooltip
|
|
@@ -9,8 +9,6 @@
|
|
|
9
9
|
display: flex;
|
|
10
10
|
flex-direction: row;
|
|
11
11
|
justify-content: space-between;
|
|
12
|
-
// MobilePushNew's .mpush-cta-buttons padding is for the Buttons section, not this link row
|
|
13
|
-
padding-bottom: 0;
|
|
14
12
|
|
|
15
13
|
.mpush-render-btn-length {
|
|
16
14
|
margin-top: $CAP_SPACE_12;
|
|
@@ -33,18 +31,6 @@
|
|
|
33
31
|
margin-top: $CAP_SPACE_12;
|
|
34
32
|
}
|
|
35
33
|
|
|
36
|
-
// External link column: its label row (heading + "Add label") gets the height of the
|
|
37
|
-
// "Type of link" label plus its 8px gap, so the input lines up with the dropdown
|
|
38
|
-
.mpush-cta-external-link-field {
|
|
39
|
-
width: 70%;
|
|
40
|
-
|
|
41
|
-
> .ant-col > .ant-row:first-child {
|
|
42
|
-
height: 1.449rem; // CapHeading h4 line height
|
|
43
|
-
margin-bottom: $CAP_SPACE_08;
|
|
44
|
-
justify-content: space-between;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
34
|
.mpush-cta-save-delete-btn {
|
|
49
35
|
margin-top: $CAP_SPACE_16;
|
|
50
36
|
|
|
@@ -56,18 +42,8 @@
|
|
|
56
42
|
}
|
|
57
43
|
}
|
|
58
44
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
margin-top: $CAP_SPACE_16;
|
|
62
|
-
|
|
63
|
-
.mpush-deep-link-key {
|
|
64
|
-
margin-top: $CAP_SPACE_12;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.cta-deep-link-keys-value {
|
|
68
|
-
display: block;
|
|
69
|
-
margin: 0 0 $CAP_SPACE_08;
|
|
70
|
-
}
|
|
45
|
+
.cta-deep-link-keys-value {
|
|
46
|
+
margin: $CAP_SPACE_08 0;
|
|
71
47
|
}
|
|
72
48
|
|
|
73
49
|
}
|
|
@@ -79,27 +55,13 @@
|
|
|
79
55
|
padding: $CAP_SPACE_08 $CAP_SPACE_12;
|
|
80
56
|
border-radius: $CAP_SPACE_04;
|
|
81
57
|
height: $CAP_SPACE_40;
|
|
82
|
-
gap: $CAP_SPACE_12;
|
|
83
58
|
|
|
84
59
|
.mpush-saved-cta-button-text {
|
|
85
60
|
font-weight: 500;
|
|
86
61
|
}
|
|
87
62
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
display: flex;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// URL fills the space up to the icons and ends in "..." when too long.
|
|
94
|
-
// contain: inline-size stops a long URL from widening the whole form.
|
|
95
|
-
.mpush-saved-cta-link {
|
|
96
|
-
flex: 1;
|
|
97
|
-
min-width: 0;
|
|
98
|
-
contain: inline-size;
|
|
99
|
-
white-space: nowrap;
|
|
100
|
-
overflow: hidden;
|
|
101
|
-
text-overflow: ellipsis;
|
|
102
|
-
color: $CAP_G04;
|
|
63
|
+
.mpush-saved-cta-edit-icon {
|
|
64
|
+
margin-left: 4.286rem;
|
|
103
65
|
}
|
|
104
66
|
}
|
|
105
67
|
.cta-label {
|
|
@@ -127,5 +89,5 @@
|
|
|
127
89
|
padding-left: 1rem;
|
|
128
90
|
}
|
|
129
91
|
.btn-text {
|
|
130
|
-
margin-left: $
|
|
92
|
+
margin-left: $CAP_SPACE_24;
|
|
131
93
|
}
|
|
@@ -29,7 +29,6 @@ import _ from 'lodash';
|
|
|
29
29
|
import { FormattedMessage, injectIntl, intlShape } from 'react-intl';
|
|
30
30
|
import { createStructuredSelector } from 'reselect';
|
|
31
31
|
import messages from './messages';
|
|
32
|
-
import TagFallbackPanel from './TagFallbackPanel';
|
|
33
32
|
import { makeSelectLoyaltyPromotionDisplay } from '../../v2Containers/Cap/selectors';
|
|
34
33
|
import { CARD_RELATED_TAGS, HOSPITALITY_RELATED_TAGS, CUSTOMER_BARCODE_TAG, GET_TRANSLATION_MAPPED ,JAPANESE_HELP_TEXT, TAG_TRANSLATION_DOC} from '../../constants/unified';
|
|
35
34
|
import { hasCardBasedScope, hasCustomerBarcodeFeatureEnabled, hasHospitalityBasedScope } from '../../utils/common';
|
|
@@ -39,7 +38,7 @@ import { hidingDateTagsForJpLocale } from '../../v2Containers/TagList/utils';
|
|
|
39
38
|
|
|
40
39
|
const {Search} = CapInput;
|
|
41
40
|
|
|
42
|
-
|
|
41
|
+
class CapTagList extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
43
42
|
constructor(props) {
|
|
44
43
|
super(props);
|
|
45
44
|
this.state = {
|
|
@@ -56,8 +55,6 @@ export class CapTagList extends React.Component { // eslint-disable-line react/p
|
|
|
56
55
|
selectedContext: 'Outbound',
|
|
57
56
|
isLoadingLoyaltyTags: false,
|
|
58
57
|
isLoadingContextChange: false,
|
|
59
|
-
// leaf tag clicked from the list, fallback panel is shown for it
|
|
60
|
-
selectedTag: null,
|
|
61
58
|
};
|
|
62
59
|
this.renderTags = this.renderTags.bind(this);
|
|
63
60
|
this.getSearchedExpandedKeys = this.getSearchedExpandedKeys.bind(this);
|
|
@@ -88,11 +85,6 @@ export class CapTagList extends React.Component { // eslint-disable-line react/p
|
|
|
88
85
|
});
|
|
89
86
|
}
|
|
90
87
|
|
|
91
|
-
// hidePopover mode: modal is closed by the parent, go back to the tag list for next open
|
|
92
|
-
if (prevProps.visibleTaglist && !this.props.visibleTaglist && this.state.selectedTag) {
|
|
93
|
-
this.setState({ selectedTag: null, selectedNodeKey: '' });
|
|
94
|
-
}
|
|
95
|
-
|
|
96
88
|
// Reset loading states when tags are received after context change
|
|
97
89
|
if ((this.state.isLoadingLoyaltyTags || this.state.isLoadingContextChange)
|
|
98
90
|
&& this.props.tags !== prevProps.tags) {
|
|
@@ -226,15 +218,8 @@ export class CapTagList extends React.Component { // eslint-disable-line react/p
|
|
|
226
218
|
if (ifDynamicTag) {
|
|
227
219
|
this.renderDynamicTagFlow();
|
|
228
220
|
} else {
|
|
229
|
-
|
|
230
|
-
this.setState({
|
|
231
|
-
selectedTag: {
|
|
232
|
-
tagKey: selectedTagValue,
|
|
233
|
-
tagName: nodeData?.tagName,
|
|
234
|
-
parentName: nodeData?.parentName,
|
|
235
|
-
info,
|
|
236
|
-
},
|
|
237
|
-
});
|
|
221
|
+
this.props.onSelect([selectedTagValue], info);
|
|
222
|
+
this.setState({visible: false});
|
|
238
223
|
}
|
|
239
224
|
} else if (!isLeaf) {
|
|
240
225
|
this.handleOnExpand(selectedKeys[0]);
|
|
@@ -253,18 +238,8 @@ export class CapTagList extends React.Component { // eslint-disable-line react/p
|
|
|
253
238
|
this.setState({expandedKeys, autoExpandParent: false});
|
|
254
239
|
};
|
|
255
240
|
|
|
256
|
-
handleFallbackBack = () => {
|
|
257
|
-
this.setState({selectedTag: null, selectedNodeKey: ''});
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
handleFallbackInsert = (tagValue) => {
|
|
261
|
-
const { info } = this.state.selectedTag || {};
|
|
262
|
-
this.props.onSelect([tagValue], info);
|
|
263
|
-
this.setState({visible: false, selectedTag: null, selectedNodeKey: ''});
|
|
264
|
-
};
|
|
265
|
-
|
|
266
241
|
togglePopoverVisibility = (visible) => {
|
|
267
|
-
this.setState(
|
|
242
|
+
this.setState({visible});
|
|
268
243
|
// Call onVisibleChange callback if provided (for triggering API calls when popover opens)
|
|
269
244
|
if (this.props.onVisibleChange) {
|
|
270
245
|
this.props.onVisibleChange(visible);
|
|
@@ -275,7 +250,7 @@ export class CapTagList extends React.Component { // eslint-disable-line react/p
|
|
|
275
250
|
this.setState({showModal: true, visible: false});
|
|
276
251
|
};
|
|
277
252
|
|
|
278
|
-
renderTags = (tags, parentPath = ''
|
|
253
|
+
renderTags = (tags, parentPath = '') => {
|
|
279
254
|
const searchString = this.state.searchValue || '';
|
|
280
255
|
const {
|
|
281
256
|
disableRelatedTags, childTagsToDisable, parentTagstoDisable,
|
|
@@ -316,7 +291,7 @@ export class CapTagList extends React.Component { // eslint-disable-line react/p
|
|
|
316
291
|
|| tagNameWithoutUnderscore.includes(searchStringLower));
|
|
317
292
|
if (_.has(val, 'subtags')) {
|
|
318
293
|
const disabled = disableRelatedTags ? parentTagstoDisable.includes(key) : false;
|
|
319
|
-
const temp = this.renderTags(val?.subtags, nodeKey
|
|
294
|
+
const temp = this.renderTags(val?.subtags, nodeKey);
|
|
320
295
|
if (temp?.length) {
|
|
321
296
|
const node = {
|
|
322
297
|
title: disabled ? <CapTooltip title={loyaltyAttrDisableText}>{val?.name}</CapTooltip> : val?.name,
|
|
@@ -349,8 +324,6 @@ export class CapTagList extends React.Component { // eslint-disable-line react/p
|
|
|
349
324
|
key: nodeKey,
|
|
350
325
|
tag: val,
|
|
351
326
|
tagKey: rawKey,
|
|
352
|
-
tagName: val?.desc || val?.name,
|
|
353
|
-
parentName,
|
|
354
327
|
isLeaf: true,
|
|
355
328
|
disabled: childDisabled,
|
|
356
329
|
};
|
|
@@ -396,24 +369,12 @@ export class CapTagList extends React.Component { // eslint-disable-line react/p
|
|
|
396
369
|
key: 'loyalty',
|
|
397
370
|
},
|
|
398
371
|
];
|
|
399
|
-
const
|
|
400
|
-
const contentSection = selectedTag ? (
|
|
401
|
-
<CapRow useLegacy className="cap-tag-list-popover-inner">
|
|
402
|
-
<TagFallbackPanel
|
|
403
|
-
tagKey={selectedTag?.tagKey}
|
|
404
|
-
tagName={selectedTag?.tagName}
|
|
405
|
-
parentName={selectedTag?.parentName}
|
|
406
|
-
onBack={this.handleFallbackBack}
|
|
407
|
-
onInsert={this.handleFallbackInsert}
|
|
408
|
-
/>
|
|
409
|
-
</CapRow>
|
|
410
|
-
) : (
|
|
372
|
+
const contentSection = (
|
|
411
373
|
<CapRow useLegacy className="cap-tag-list-popover-inner">
|
|
412
374
|
<CapSpin tip={formatMessage(messages.gettingTags)} spinning={shouldShowLoading}>
|
|
413
375
|
<Search
|
|
414
376
|
style={{ marginBottom: 8, width: '250px'}}
|
|
415
377
|
placeholder={formatMessage(messages.search)}
|
|
416
|
-
value={this.state.searchValue}
|
|
417
378
|
onChange={this.onChange} />
|
|
418
379
|
{moduleFilterEnabled ? (
|
|
419
380
|
<CapSelect
|
|
@@ -58,48 +58,4 @@ export default defineMessages({
|
|
|
58
58
|
id: `creatives.componentsV2.CapTagList.labelFetchErrorMsg`,
|
|
59
59
|
defaultMessage: 'Unable to fetch the labels. Please try again later'
|
|
60
60
|
},
|
|
61
|
-
fallbackBehaviour: {
|
|
62
|
-
id: `creatives.componentsV2.CapTagList.fallbackBehaviour`,
|
|
63
|
-
defaultMessage: 'Fallback behaviour',
|
|
64
|
-
},
|
|
65
|
-
fallbackBehaviourDesc: {
|
|
66
|
-
id: `creatives.componentsV2.CapTagList.fallbackBehaviourDesc`,
|
|
67
|
-
defaultMessage: 'If the tag has no value for a customer',
|
|
68
|
-
},
|
|
69
|
-
dontSendMessage: {
|
|
70
|
-
id: `creatives.componentsV2.CapTagList.dontSendMessage`,
|
|
71
|
-
defaultMessage: 'Don’t send message',
|
|
72
|
-
},
|
|
73
|
-
sendWithNullValue: {
|
|
74
|
-
id: `creatives.componentsV2.CapTagList.sendWithNullValue`,
|
|
75
|
-
defaultMessage: 'Send with null value',
|
|
76
|
-
},
|
|
77
|
-
fallbackValue: {
|
|
78
|
-
id: `creatives.componentsV2.CapTagList.fallbackValue`,
|
|
79
|
-
defaultMessage: 'Fallback value',
|
|
80
|
-
},
|
|
81
|
-
fallbackValuePlaceholder: {
|
|
82
|
-
id: `creatives.componentsV2.CapTagList.fallbackValuePlaceholder`,
|
|
83
|
-
defaultMessage: 'Enter fallback value',
|
|
84
|
-
},
|
|
85
|
-
fallbackValueInvalid: {
|
|
86
|
-
id: `creatives.componentsV2.CapTagList.fallbackValueInvalid`,
|
|
87
|
-
defaultMessage: 'Fallback value cannot contain { } or both single and double quotes',
|
|
88
|
-
},
|
|
89
|
-
addsToMessageAs: {
|
|
90
|
-
id: `creatives.componentsV2.CapTagList.addsToMessageAs`,
|
|
91
|
-
defaultMessage: 'Adds to the message as',
|
|
92
|
-
},
|
|
93
|
-
insertTag: {
|
|
94
|
-
id: `creatives.componentsV2.CapTagList.insertTag`,
|
|
95
|
-
defaultMessage: 'Insert tag',
|
|
96
|
-
},
|
|
97
|
-
back: {
|
|
98
|
-
id: `creatives.componentsV2.CapTagList.back`,
|
|
99
|
-
defaultMessage: 'Back',
|
|
100
|
-
},
|
|
101
|
-
copy: {
|
|
102
|
-
id: `creatives.componentsV2.CapTagList.copy`,
|
|
103
|
-
defaultMessage: 'Copy',
|
|
104
|
-
},
|
|
105
61
|
});
|
|
@@ -56,116 +56,4 @@
|
|
|
56
56
|
|
|
57
57
|
.ant-popover-container.tag-list-popover-container.tag-list-popover-container {
|
|
58
58
|
background-color: $CAP_WHITE;
|
|
59
|
-
}
|
|
60
|
-
.tag-fallback-panel {
|
|
61
|
-
width: 20rem;
|
|
62
|
-
max-width: 100%;
|
|
63
|
-
|
|
64
|
-
.tag-fallback-header {
|
|
65
|
-
padding-bottom: $CAP_SPACE_16;
|
|
66
|
-
margin-bottom: $CAP_SPACE_16;
|
|
67
|
-
border-bottom: 1px solid $CAP_G07;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.tag-fallback-title-row {
|
|
71
|
-
gap: $CAP_SPACE_16;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.tag-fallback-back {
|
|
75
|
-
flex-shrink: 0;
|
|
76
|
-
color: $FONT_COLOR_02;
|
|
77
|
-
cursor: pointer;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.tag-fallback-tag-name {
|
|
81
|
-
margin: 0;
|
|
82
|
-
min-width: 0;
|
|
83
|
-
word-break: break-word;
|
|
84
|
-
font-size: 1rem;
|
|
85
|
-
font-weight: $FONT_WEIGHT_MEDIUM;
|
|
86
|
-
line-height: 1.5rem;
|
|
87
|
-
color: $FONT_COLOR_01;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// indented by back icon width + gap, so it starts below the tag name
|
|
91
|
-
.tag-fallback-group-name {
|
|
92
|
-
margin: $CAP_SPACE_02 0 0 calc(#{$CAP_SPACE_24} + #{$CAP_SPACE_16});
|
|
93
|
-
word-break: break-word;
|
|
94
|
-
font-size: 0.8rem;
|
|
95
|
-
font-weight: $FONT_WEIGHT_REGULAR;
|
|
96
|
-
color: $FONT_COLOR_02;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.tag-fallback-heading {
|
|
100
|
-
margin: 0;
|
|
101
|
-
font-size: $FONT_SIZE_M;
|
|
102
|
-
font-weight: $FONT_WEIGHT_MEDIUM;
|
|
103
|
-
line-height: 1.43rem;
|
|
104
|
-
color: $FONT_COLOR_01;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.tag-fallback-subtext {
|
|
108
|
-
margin-top: $CAP_SPACE_02;
|
|
109
|
-
font-size: $FONT_SIZE_S;
|
|
110
|
-
font-weight: $FONT_WEIGHT_REGULAR;
|
|
111
|
-
color: $FONT_COLOR_02;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.tag-fallback-options {
|
|
115
|
-
display: flex;
|
|
116
|
-
flex-direction: column;
|
|
117
|
-
margin: $CAP_SPACE_16 0;
|
|
118
|
-
|
|
119
|
-
.ant-radio-wrapper,
|
|
120
|
-
.ant-radio-wrapper span {
|
|
121
|
-
font-size: $FONT_SIZE_M;
|
|
122
|
-
font-weight: $FONT_WEIGHT_REGULAR;
|
|
123
|
-
color: $FONT_COLOR_01;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.tag-fallback-input {
|
|
128
|
-
margin-bottom: $CAP_SPACE_16;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
.tag-fallback-preview-label {
|
|
132
|
-
margin: $CAP_SPACE_24 0 $CAP_SPACE_08;
|
|
133
|
-
font-size: $FONT_SIZE_S;
|
|
134
|
-
font-weight: $FONT_WEIGHT_REGULAR;
|
|
135
|
-
color: $FONT_COLOR_02;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.tag-fallback-preview-row {
|
|
139
|
-
gap: $CAP_SPACE_12;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.tag-fallback-preview {
|
|
143
|
-
flex: 1;
|
|
144
|
-
min-width: 0;
|
|
145
|
-
padding: $CAP_SPACE_08 $CAP_SPACE_12;
|
|
146
|
-
border: 1px solid $CAP_COLOR_01;
|
|
147
|
-
border-radius: $CAP_SPACE_04;
|
|
148
|
-
background: $BG_08;
|
|
149
|
-
color: map-get($CAP_PRIMARY, hover);
|
|
150
|
-
font-family: 'Roboto Mono', Menlo, Consolas, monospace;
|
|
151
|
-
font-size: $FONT_SIZE_S;
|
|
152
|
-
line-height: 1.143rem;
|
|
153
|
-
word-break: break-all;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
.tag-fallback-copy {
|
|
157
|
-
flex-shrink: 0;
|
|
158
|
-
color: $FONT_COLOR_02;
|
|
159
|
-
cursor: pointer;
|
|
160
|
-
|
|
161
|
-
&:hover {
|
|
162
|
-
color: $FONT_COLOR_01;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.tag-fallback-footer {
|
|
167
|
-
margin-top: $CAP_SPACE_16;
|
|
168
|
-
padding-top: $CAP_SPACE_12;
|
|
169
|
-
border-top: 1px solid $CAP_G07;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
59
|
+
}
|
|
@@ -23,7 +23,6 @@ const iPhonePushMessagePhone = require('../../TemplatePreview/assets/images/iOS_
|
|
|
23
23
|
|
|
24
24
|
// Import video play icon for carousel
|
|
25
25
|
const videoPlay = require('../../../assets/videoPlay.svg');
|
|
26
|
-
const videoEmptyPreview = require('../../TemplatePreview/assets/images/empty_video_preview.svg');
|
|
27
26
|
|
|
28
27
|
const MobilePushPreviewContent = ({
|
|
29
28
|
content,
|
|
@@ -87,15 +86,14 @@ const MobilePushPreviewContent = ({
|
|
|
87
86
|
|
|
88
87
|
// Render MobilePush carousel (based on TemplatePreview renderMobilePushCarousel)
|
|
89
88
|
const renderMobilePushCarousel = (contentData) => {
|
|
90
|
-
// Every card shows, even before its media is uploaded (an empty card keeps its place)
|
|
91
89
|
if (!contentData?.carouselData || contentData?.carouselData?.length === 0) {
|
|
92
90
|
return null;
|
|
93
91
|
}
|
|
94
92
|
|
|
95
93
|
return (
|
|
96
94
|
<CapRow type="flex" vertical noWrap className="msg-container-carousel mobile-push-carousel-container">
|
|
97
|
-
<CapRow
|
|
98
|
-
{contentData
|
|
95
|
+
<CapRow useLegacy className="scroll-container mobile-push-scroll-container">
|
|
96
|
+
{contentData?.carouselData?.map((item, idx) => (
|
|
99
97
|
<CapColumn
|
|
100
98
|
key={`carousel-card-${idx}`}
|
|
101
99
|
className="mobile-push-carousel-card message-pop align-left message-pop-carousel"
|
|
@@ -107,11 +105,10 @@ const MobilePushPreviewContent = ({
|
|
|
107
105
|
className="carousel-image"
|
|
108
106
|
/>
|
|
109
107
|
)}
|
|
110
|
-
{item?.mediaType?.toLowerCase() === MEDIA_TYPE_VIDEO.toLowerCase() &&
|
|
108
|
+
{item?.mediaType?.toLowerCase() === MEDIA_TYPE_VIDEO.toLowerCase() && item?.videoPreviewImg && (
|
|
111
109
|
<CapRow className="video-preview">
|
|
112
|
-
{/* No thumbnail from the upload: same placeholder as WhatsApp/RCS */}
|
|
113
110
|
<CapImage
|
|
114
|
-
src={item?.videoPreviewImg ||
|
|
111
|
+
src={item?.videoPreviewImg || item?.url}
|
|
115
112
|
alt="carousel-video-preview"
|
|
116
113
|
className="carousel-video-preview"
|
|
117
114
|
/>
|
|
@@ -220,15 +217,15 @@ const MobilePushPreviewContent = ({
|
|
|
220
217
|
{/* Action Buttons */}
|
|
221
218
|
{(deviceContent?.actions || []).filter((action) => action?.label || action?.actionText).length > 0
|
|
222
219
|
&& deviceContent?.carouselData?.length === 0 && (
|
|
223
|
-
<CapRow
|
|
224
|
-
{deviceContent
|
|
220
|
+
<CapRow useLegacy className="actions">
|
|
221
|
+
{(deviceContent?.actions || []).map((action) => (
|
|
225
222
|
(action?.label || action?.actionText) && (
|
|
226
223
|
<span
|
|
227
224
|
className="action"
|
|
228
|
-
key={`action-${
|
|
225
|
+
key={`action-${action?.label || action?.actionText}`}
|
|
229
226
|
title={action?.url || action?.actionLink || ''}
|
|
230
227
|
>
|
|
231
|
-
{action?.label || action?.actionText}
|
|
228
|
+
{action?.label?.toUpperCase() || action?.actionText?.toUpperCase()}
|
|
232
229
|
</span>
|
|
233
230
|
)
|
|
234
231
|
))}
|
|
@@ -2307,21 +2307,9 @@
|
|
|
2307
2307
|
flex-direction: row;
|
|
2308
2308
|
gap: $CAP_SPACE_08;
|
|
2309
2309
|
|
|
2310
|
-
// One button: centred. Two: equal halves, each centred, split by a divider.
|
|
2311
2310
|
.action {
|
|
2312
2311
|
font-size: $FONT_SIZE_S;
|
|
2313
|
-
|
|
2314
|
-
color: $FONT_COLOR_01;
|
|
2315
|
-
flex: 1 1 0;
|
|
2316
|
-
min-width: 0;
|
|
2317
|
-
text-align: center;
|
|
2318
|
-
white-space: nowrap;
|
|
2319
|
-
overflow: hidden;
|
|
2320
|
-
text-overflow: ellipsis;
|
|
2321
|
-
|
|
2322
|
-
& + .action {
|
|
2323
|
-
border-left: 1px solid $CAP_G07;
|
|
2324
|
-
}
|
|
2312
|
+
// Additional action button styles from TemplatePreview
|
|
2325
2313
|
}
|
|
2326
2314
|
}
|
|
2327
2315
|
}
|
|
@@ -212,8 +212,6 @@ export const CTA_TYPE_EXTERNAL_URL = 'EXTERNAL_URL';
|
|
|
212
212
|
// ============================================
|
|
213
213
|
export const STYLE_TYPE_BIG_PICTURE = 'BIG_PICTURE';
|
|
214
214
|
export const STYLE_TYPE_BIG_TEXT = 'BIG_TEXT';
|
|
215
|
-
export const STYLE_TYPE_VIDEO = 'VIDEO';
|
|
216
|
-
export const STYLE_TYPE_MANUAL_CAROUSEL = 'MANUAL_CAROUSEL';
|
|
217
215
|
|
|
218
216
|
// ============================================
|
|
219
217
|
// DEVICE TYPE CONSTANTS (for API payloads)
|