@capillarytech/creatives-library 8.0.339 → 8.0.340-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/app.js +8 -1
- package/global-styles.js +4 -0
- package/package.json +2 -2
- package/styles/components/navigation/_leftnav.scss +1 -1
- package/utils/tests/tagValidations.test.js +20 -0
- package/v2Components/AccessForbidden/index.js +1 -1
- package/v2Components/CapActionButton/index.js +5 -5
- package/v2Components/CapCustomSkeleton/index.js +1 -1
- package/v2Components/CapDeviceContent/index.js +5 -5
- package/v2Components/CapDocumentUpload/index.js +1 -1
- package/v2Components/CapImageUpload/index.js +1 -1
- package/v2Components/CapInAppCTA/index.js +118 -112
- package/v2Components/CapMpushCTA/index.js +72 -66
- package/v2Components/CapTagList/index.js +32 -27
- package/v2Components/CapTagList/style.scss +29 -0
- package/v2Components/CapTagListWithInput/__tests__/CapTagListWithInput.test.js +63 -0
- package/v2Components/CapTagListWithInput/index.js +4 -0
- package/v2Components/CapVideoUpload/index.js +1 -1
- package/v2Components/CapWhatsappCTA/index.js +130 -124
- package/v2Components/CapWhatsappCarouselButton/index.js +27 -29
- package/v2Components/CapWhatsappQuickReply/index.js +7 -7
- package/v2Components/Carousel/index.js +1 -1
- package/v2Components/CommonTestAndPreview/AddTestCustomer.js +1 -1
- package/v2Components/CommonTestAndPreview/CustomValuesEditor.js +3 -3
- package/v2Components/CommonTestAndPreview/CustomerCreationModal.js +1 -1
- package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +4 -4
- package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +1 -1
- package/v2Components/CommonTestAndPreview/ExistingCustomerModal.js +6 -6
- package/v2Components/CommonTestAndPreview/LeftPanelContent.js +5 -5
- package/v2Components/CommonTestAndPreview/PreviewSection.js +1 -1
- package/v2Components/CommonTestAndPreview/UnifiedPreview/DeviceFrame.js +1 -1
- package/v2Components/CommonTestAndPreview/UnifiedPreview/EmailPreviewContent.js +8 -8
- package/v2Components/CommonTestAndPreview/UnifiedPreview/InAppPreviewContent.js +14 -13
- package/v2Components/CommonTestAndPreview/UnifiedPreview/MobilePushPreviewContent.js +22 -21
- package/v2Components/CommonTestAndPreview/UnifiedPreview/RcsPreviewContent.js +9 -9
- package/v2Components/CommonTestAndPreview/UnifiedPreview/SmsPreviewContent.js +8 -8
- package/v2Components/CommonTestAndPreview/UnifiedPreview/ViberPreviewContent.js +10 -10
- package/v2Components/CommonTestAndPreview/UnifiedPreview/WhatsAppPreviewContent.js +13 -12
- package/v2Components/CommonTestAndPreview/UnifiedPreview/ZaloPreviewContent.js +4 -3
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +10 -5
- package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +1 -1
- package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +3 -4
- package/v2Components/CommonTestAndPreview/index.js +1 -1
- package/v2Components/CustomerSearchSection/_customerSearch.scss +2 -1
- package/v2Components/CustomerSearchSection/index.js +9 -9
- package/v2Components/EmailMobilePreview/index.js +1 -1
- package/v2Components/ErrorInfoNote/index.js +13 -11
- package/v2Components/ErrorInfoNote/style.scss +1 -1
- package/v2Components/FormBuilder/_formBuilder.scss +1 -0
- package/v2Components/FormBuilder/index.js +39 -40
- package/v2Components/HtmlEditor/HTMLEditor.js +10 -5
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +1 -0
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +927 -2
- package/v2Components/HtmlEditor/_htmlEditor.scss +2 -1
- package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +4 -1
- package/v2Components/HtmlEditor/components/DeviceToggle/_deviceToggle.scss +2 -2
- package/v2Components/HtmlEditor/components/DeviceToggle/index.js +2 -2
- package/v2Components/HtmlEditor/components/EditorToolbar/PreviewModeGroup.js +2 -2
- package/v2Components/HtmlEditor/components/EditorToolbar/index.js +2 -2
- package/v2Components/HtmlEditor/components/InAppPreviewPane/index.js +1 -0
- package/v2Components/HtmlEditor/components/PreviewPane/index.js +2 -2
- package/v2Components/HtmlEditor/components/SplitContainer/SplitContainer.js +2 -2
- package/v2Components/HtmlEditor/components/SplitContainer/_splitContainer.scss +2 -1
- package/v2Components/HtmlEditor/components/ValidationPanel/index.js +6 -9
- package/v2Components/HtmlEditor/components/ValidationTabs/index.js +2 -2
- package/v2Components/NavigationBar/index.js +7 -1
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +3 -4
- package/v2Components/TemplatePreview/_templatePreview.scss +5 -3
- package/v2Components/TemplatePreview/index.js +11 -9
- package/v2Components/TestAndPreviewSlidebox/CustomValuesEditor.js +3 -3
- package/v2Components/TestAndPreviewSlidebox/LeftPanelContent.js +5 -5
- package/v2Components/TestAndPreviewSlidebox/PreviewSection.js +3 -3
- package/v2Components/TestAndPreviewSlidebox/_testAndPreviewSlidebox.scss +4 -2
- package/v2Containers/BeeEditor/index.js +3 -0
- package/v2Containers/BeePopupEditor/index.js +1 -1
- package/v2Containers/CommunicationFlow/CommunicationFlow.js +5 -5
- package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/ChannelSelectionStep.js +4 -3
- package/v2Containers/CommunicationFlow/steps/CommunicationStrategyStep/CommunicationStrategyStep.js +2 -2
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/DeliverySettingsSection.js +3 -2
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/SenderDetails.js +7 -7
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/SenderDetails.scss +0 -5
- package/v2Containers/CommunicationFlow/steps/DynamicControlsStep/DynamicControlsStep.js +2 -2
- package/v2Containers/CommunicationFlow/steps/MessageTypeStep/MessageTypeStep.js +2 -2
- package/v2Containers/CreativesContainer/SlideBoxContent.js +28 -1
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +1 -1
- package/v2Containers/CreativesContainer/index.js +4 -1
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +47 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +5 -0
- package/v2Containers/Ebill/index.js +10 -9
- package/v2Containers/Email/index.js +8 -7
- package/v2Containers/Email/initialSchema.js +1 -1
- package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +6 -1
- package/v2Containers/EmailWrapper/components/EmailWrapperView.js +3 -0
- package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +20 -2
- package/v2Containers/EmailWrapper/components/__tests__/EmailWrapperView.test.js +16 -1
- package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +3 -0
- package/v2Containers/EmailWrapper/index.js +4 -0
- package/v2Containers/EmailWrapper/tests/useEmailWrapper.edgeCases.test.js +1 -0
- package/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +9 -0
- package/v2Containers/FTP/index.js +1 -1
- package/v2Containers/Facebook/Advertisement/index.js +4 -4
- package/v2Containers/Facebook/index.js +2 -2
- package/v2Containers/InApp/index.js +21 -16
- package/v2Containers/InApp/index.scss +0 -7
- package/v2Containers/InAppWrapper/components/InAppWrapperView.js +2 -2
- package/v2Containers/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +1 -0
- package/v2Containers/InappAdvance/index.js +4 -4
- package/v2Containers/LanguageProvider/index.js +3 -3
- package/v2Containers/LanguageProvider/tests/index.test.js +3 -3
- package/v2Containers/Line/Container/Image/index.js +1 -1
- package/v2Containers/Line/Container/ImageCarousel/Content.js +1 -1
- package/v2Containers/Line/Container/ImageCarousel/index.js +5 -5
- package/v2Containers/Line/Container/ImageMap/index.js +3 -3
- package/v2Containers/Line/Container/Sticker/index.js +2 -2
- package/v2Containers/Line/Container/Sticker/utils.js +1 -1
- package/v2Containers/Line/Container/Video/index.js +1 -1
- package/v2Containers/Line/Container/Wrapper/index.js +3 -3
- package/v2Containers/Line/Container/Wrapper/style.js +1 -5
- package/v2Containers/Line/Container/index.js +2 -2
- package/v2Containers/Login/components/LoginForm/index.js +34 -47
- package/v2Containers/Login/index.js +5 -5
- package/v2Containers/MobilePush/Create/index.js +2 -0
- package/v2Containers/MobilePush/Edit/index.js +2 -0
- package/v2Containers/MobilePushNew/components/CtaButtons.js +2 -2
- package/v2Containers/MobilePushNew/components/MediaUploaders.js +9 -9
- package/v2Containers/MobilePushNew/components/PlatformContentFields.js +4 -4
- package/v2Containers/MobilePushNew/index.js +2 -2
- package/v2Containers/MobilePushNew/index.scss +6 -3
- package/v2Containers/MobilepushWrapper/index.js +3 -1
- package/v2Containers/Rcs/index.js +25 -19
- package/v2Containers/Rcs/index.scss +0 -7
- package/v2Containers/Sms/Create/index.js +2 -0
- package/v2Containers/Sms/Edit/index.js +2 -0
- package/v2Containers/SmsTrai/Edit/index.js +5 -2
- package/v2Containers/SmsWrapper/index.js +2 -0
- package/v2Containers/TagList/index.js +62 -5
- package/v2Containers/TagList/messages.js +4 -0
- package/v2Containers/TagList/tests/TagList.test.js +124 -20
- package/v2Containers/TagList/tests/mockdata.js +17 -0
- package/v2Containers/Templates/index.js +16 -16
- package/v2Containers/Viber/index.js +22 -14
- package/v2Containers/Viber/index.scss +0 -7
- package/v2Containers/WeChat/RichmediaTemplates/Create/_createRichmedia.scss +1 -1
- package/v2Containers/WeChat/RichmediaTemplates/Create/index.js +2 -2
- package/v2Containers/WebPush/Create/components/BrandIconSection.js +1 -1
- package/v2Containers/WebPush/Create/components/ButtonForm.js +2 -2
- package/v2Containers/WebPush/Create/components/ButtonList.js +4 -4
- package/v2Containers/WebPush/Create/components/ButtonsLinksSection.js +4 -4
- package/v2Containers/WebPush/Create/components/FormActions.js +3 -3
- package/v2Containers/WebPush/Create/components/MessageSection.js +2 -2
- package/v2Containers/WebPush/Create/components/NotificationTitleSection.js +2 -2
- package/v2Containers/WebPush/Create/components/_buttons.scss +2 -2
- package/v2Containers/WebPush/Create/hooks/useTagManagement.js +0 -2
- package/v2Containers/WebPush/Create/index.js +9 -1
- package/v2Containers/WebPush/Create/index.scss +6 -3
- package/v2Containers/WebPush/Create/preview/WebPushPreview.js +1 -1
- package/v2Containers/Whatsapp/index.js +33 -28
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +20 -0
- package/v2Containers/Zalo/index.js +5 -3
|
@@ -234,16 +234,18 @@ export const CapMpushCTA = (props) => {
|
|
|
234
234
|
align="middle"
|
|
235
235
|
type="flex"
|
|
236
236
|
>
|
|
237
|
-
<
|
|
238
|
-
<
|
|
239
|
-
<
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
<
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
237
|
+
<CapColumn>
|
|
238
|
+
<CapRow className="mpush-cta-row">
|
|
239
|
+
<CapColumn>
|
|
240
|
+
<CapIcon size="s" type={'launch'} />
|
|
241
|
+
</CapColumn>
|
|
242
|
+
<CapColumn className="btn-text">
|
|
243
|
+
<CapLabel type="label2" className="mpush-saved-cta-button-text">
|
|
244
|
+
{text}
|
|
245
|
+
</CapLabel>
|
|
246
|
+
</CapColumn>
|
|
247
|
+
</CapRow>
|
|
248
|
+
</CapColumn>
|
|
247
249
|
<CapColumn >
|
|
248
250
|
{urlType === DEEP_LINK ?
|
|
249
251
|
<CapTag className="cta-type-label">{formatMessage(messages.urlDeepLink)}</CapTag>
|
|
@@ -254,7 +256,7 @@ export const CapMpushCTA = (props) => {
|
|
|
254
256
|
</CapColumn>
|
|
255
257
|
<CapColumn>
|
|
256
258
|
</CapColumn>
|
|
257
|
-
|
|
259
|
+
<CapColumn>
|
|
258
260
|
<CapRow className="cta-action-grp">
|
|
259
261
|
<CapColumn
|
|
260
262
|
className="mpush-saved-cta-edit-icon"
|
|
@@ -266,7 +268,7 @@ export const CapMpushCTA = (props) => {
|
|
|
266
268
|
<CapIcon size="s" type="delete" className="cta-action" ariaLabel="delete-cta-icon" />
|
|
267
269
|
</CapColumn>
|
|
268
270
|
</CapRow>
|
|
269
|
-
|
|
271
|
+
</CapColumn>
|
|
270
272
|
</CapRow>
|
|
271
273
|
);
|
|
272
274
|
} else {
|
|
@@ -290,7 +292,7 @@ export const CapMpushCTA = (props) => {
|
|
|
290
292
|
{renderLength(text.length, BTN_MAX_LENGTH)}
|
|
291
293
|
</CapColumn>
|
|
292
294
|
<CapColumn className="mpush-cta-buttons">
|
|
293
|
-
<CapRow style={{ width: '30%', marginRight: '10px' }}>
|
|
295
|
+
<CapRow useLegacy style={{ width: '30%', marginRight: '10px' }}>
|
|
294
296
|
<CapHeading type="h4" className="cta-label">
|
|
295
297
|
{formatMessage(messages.ctaType)}
|
|
296
298
|
</CapHeading>
|
|
@@ -303,7 +305,7 @@ export const CapMpushCTA = (props) => {
|
|
|
303
305
|
/>
|
|
304
306
|
</CapRow>
|
|
305
307
|
{urlType === DEEP_LINK && (
|
|
306
|
-
<CapRow style={{ width: '70%' }}>
|
|
308
|
+
<CapRow useLegacy style={{ width: '70%' }}>
|
|
307
309
|
<CapHeading type="h4" className="cta-deep-link-label">
|
|
308
310
|
{formatMessage(messages.urlDeepLink)}
|
|
309
311
|
</CapHeading>
|
|
@@ -341,59 +343,63 @@ export const CapMpushCTA = (props) => {
|
|
|
341
343
|
)}
|
|
342
344
|
</CapColumn>
|
|
343
345
|
{urlType === DEEP_LINK && ctaDeepLinkValue && deepLinkKeysFromSelectionArray.length > 0 && (
|
|
344
|
-
<
|
|
345
|
-
<
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
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>
|
|
369
373
|
)}
|
|
370
|
-
<
|
|
371
|
-
<
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
<
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
374
|
+
<CapColumn>
|
|
375
|
+
<CapRow useLegacy className="mpush-cta-save-delete-btn">
|
|
376
|
+
<CapTooltip
|
|
377
|
+
title={
|
|
378
|
+
ctaSaveDisabled(index)
|
|
379
|
+
? formatMessage(messages.ctaSaveDisabled)
|
|
380
|
+
: ""
|
|
381
|
+
}
|
|
382
|
+
placement={"bottom"}
|
|
383
|
+
>
|
|
384
|
+
<div className="button-disabled-tooltip-wrapper">
|
|
385
|
+
<CapButton
|
|
386
|
+
onClick={() => isSavedCta(index, true)}
|
|
387
|
+
disabled={ctaSaveDisabled(index)}
|
|
388
|
+
className="mpush-cta-save-btn"
|
|
389
|
+
>
|
|
390
|
+
{formatMessage(globalMessages.save)}
|
|
391
|
+
</CapButton>
|
|
392
|
+
</div>
|
|
393
|
+
</CapTooltip>
|
|
394
|
+
<CapButton
|
|
395
|
+
onClick={() => deleteHandler(index)}
|
|
396
|
+
className="mpush-cta-delete-btn"
|
|
397
|
+
type="secondary"
|
|
398
|
+
>
|
|
399
|
+
{formatMessage(globalMessages.delete)}
|
|
400
|
+
</CapButton>
|
|
401
|
+
</CapRow>
|
|
402
|
+
</CapColumn>
|
|
397
403
|
</CapRow>
|
|
398
404
|
);
|
|
399
405
|
}
|
|
@@ -44,6 +44,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
44
44
|
super(props);
|
|
45
45
|
this.state = {
|
|
46
46
|
tagValue: '',
|
|
47
|
+
selectedNodeKey: '',
|
|
47
48
|
expandedKeys: [],
|
|
48
49
|
searchValue: '',
|
|
49
50
|
autoExpandParent: true,
|
|
@@ -122,9 +123,11 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
122
123
|
this.handleOnExpand(info.node.props.eventKey);
|
|
123
124
|
};
|
|
124
125
|
|
|
125
|
-
getSearchedExpandedKeys(tags, value = '') {
|
|
126
|
+
getSearchedExpandedKeys(tags, value = '', parentPath = '') {
|
|
126
127
|
let list = [];
|
|
127
128
|
_.forEach(tags, (val = {}, key) => {
|
|
129
|
+
const rawKey = val?.incentiveSeriesId ? `${key}(${val?.incentiveSeriesId})` : `${key}`;
|
|
130
|
+
const nodeKey = parentPath ? `${parentPath}.${rawKey}` : rawKey;
|
|
128
131
|
const tagName =
|
|
129
132
|
typeof val?.name === 'string'
|
|
130
133
|
? _.toLower(_.get(val, "name", ""))
|
|
@@ -137,16 +140,16 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
137
140
|
&& (tagName.includes(searchStringLower)
|
|
138
141
|
|| tagNameWithoutUnderscore.includes(searchStringLower))
|
|
139
142
|
) {
|
|
140
|
-
list.push(
|
|
143
|
+
list.push(nodeKey);
|
|
141
144
|
}
|
|
142
|
-
const temp = this.getSearchedExpandedKeys(val?.subtags, value);
|
|
145
|
+
const temp = this.getSearchedExpandedKeys(val?.subtags, value, nodeKey);
|
|
143
146
|
list = list.concat(temp);
|
|
144
147
|
} else if (
|
|
145
148
|
val?.name
|
|
146
149
|
&& (tagName.includes(searchStringLower)
|
|
147
150
|
|| tagNameWithoutUnderscore.includes(searchStringLower))
|
|
148
151
|
) {
|
|
149
|
-
list.push(
|
|
152
|
+
list.push(nodeKey);
|
|
150
153
|
}
|
|
151
154
|
});
|
|
152
155
|
return list;
|
|
@@ -200,12 +203,17 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
200
203
|
handleOnSelect = (selectedKeys, info) => {
|
|
201
204
|
if (selectedKeys.length > 0) {
|
|
202
205
|
if (info && info.selectedNodes && info.selectedNodes.length > 0 && info.selectedNodes[0].props.isLeaf) {
|
|
203
|
-
|
|
204
|
-
const
|
|
206
|
+
const selectedNode = info.selectedNodes[0];
|
|
207
|
+
const selectedTagValue = selectedNode?.props?.tagKey || selectedKeys[0];
|
|
208
|
+
this.setState({
|
|
209
|
+
tagValue: selectedTagValue,
|
|
210
|
+
selectedNodeKey: selectedKeys[0],
|
|
211
|
+
});
|
|
212
|
+
const ifDynamicTag = this.checkIfDynamicTag(selectedTagValue);
|
|
205
213
|
if (ifDynamicTag) {
|
|
206
214
|
this.renderDynamicTagFlow();
|
|
207
215
|
} else {
|
|
208
|
-
this.props.onSelect(
|
|
216
|
+
this.props.onSelect([selectedTagValue], info);
|
|
209
217
|
this.setState({visible: false});
|
|
210
218
|
}
|
|
211
219
|
} else if (info && info.selectedNodes && info.selectedNodes.length > 0 && !info.selectedNodes[0].props.isLeaf) {
|
|
@@ -237,7 +245,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
237
245
|
this.setState({showModal: true, visible: false});
|
|
238
246
|
};
|
|
239
247
|
|
|
240
|
-
renderTags = (tags) => {
|
|
248
|
+
renderTags = (tags, parentPath = '') => {
|
|
241
249
|
const searchString = this.state.searchValue || '';
|
|
242
250
|
const {
|
|
243
251
|
disableRelatedTags, childTagsToDisable, parentTagstoDisable,
|
|
@@ -260,6 +268,8 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
260
268
|
clonedTags = _.omit(clonedTags, CUSTOMER_BARCODE_TAG);
|
|
261
269
|
}
|
|
262
270
|
_.forEach(clonedTags, (val = '', key) => {
|
|
271
|
+
const rawKey = val?.incentiveSeriesId ? `${key}(${val?.incentiveSeriesId})` : `${key}`;
|
|
272
|
+
const nodeKey = parentPath ? `${parentPath}.${rawKey}` : rawKey;
|
|
263
273
|
let supportedTagsString = '';
|
|
264
274
|
_.forEach(val.supportedTags, (supportedTag) => {
|
|
265
275
|
supportedTagsString += `${supportedTag} ,`;
|
|
@@ -276,13 +286,14 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
276
286
|
|| tagNameWithoutUnderscore.includes(searchStringLower));
|
|
277
287
|
if (_.has(val, 'subtags')) {
|
|
278
288
|
const disabled = disableRelatedTags ? parentTagstoDisable.includes(key) : false;
|
|
279
|
-
const temp = this.renderTags(val?.subtags);
|
|
289
|
+
const temp = this.renderTags(val?.subtags, nodeKey);
|
|
280
290
|
if (temp?.length) {
|
|
281
291
|
const tagValue = (
|
|
282
292
|
<CapTreeNode
|
|
283
293
|
title={disabled ? <CapTooltip title={loyaltyAttrDisableText}>{val?.name}</CapTooltip> : val?.name}
|
|
284
294
|
tag={val}
|
|
285
|
-
|
|
295
|
+
tagKey={rawKey}
|
|
296
|
+
key={nodeKey}
|
|
286
297
|
disabled={disabled}
|
|
287
298
|
>
|
|
288
299
|
{temp}
|
|
@@ -317,12 +328,9 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
317
328
|
)
|
|
318
329
|
}
|
|
319
330
|
tag={val}
|
|
331
|
+
tagKey={rawKey}
|
|
320
332
|
isLeaf
|
|
321
|
-
key={
|
|
322
|
-
val?.incentiveSeriesId
|
|
323
|
-
? `${key}(${val?.incentiveSeriesId})`
|
|
324
|
-
: `${key}`
|
|
325
|
-
}
|
|
333
|
+
key={nodeKey}
|
|
326
334
|
disabled={childDisabled}
|
|
327
335
|
>
|
|
328
336
|
</CapTreeNode>
|
|
@@ -353,12 +361,9 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
353
361
|
)
|
|
354
362
|
}
|
|
355
363
|
tag={val}
|
|
364
|
+
tagKey={rawKey}
|
|
356
365
|
isLeaf
|
|
357
|
-
key={
|
|
358
|
-
val?.incentiveSeriesId
|
|
359
|
-
? `${key}(${val?.incentiveSeriesId})`
|
|
360
|
-
: `${key}`
|
|
361
|
-
}
|
|
366
|
+
key={nodeKey}
|
|
362
367
|
disabled={childDisabled}
|
|
363
368
|
>
|
|
364
369
|
</CapTreeNode>
|
|
@@ -385,7 +390,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
385
390
|
} = this.props;
|
|
386
391
|
const {formatMessage} = intl;
|
|
387
392
|
const {
|
|
388
|
-
tagValue, expandedKeys, autoExpandParent, visible, translationLang, selectedContext, isLoadingLoyaltyTags, isLoadingContextChange,
|
|
393
|
+
tagValue, selectedNodeKey, expandedKeys, autoExpandParent, visible, translationLang, selectedContext, isLoadingLoyaltyTags, isLoadingContextChange,
|
|
389
394
|
} = this.state;
|
|
390
395
|
|
|
391
396
|
// Show loading spinner if general loading OR if specifically loading loyalty tags OR if context change is in progress
|
|
@@ -404,7 +409,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
404
409
|
},
|
|
405
410
|
];
|
|
406
411
|
const contentSection = (
|
|
407
|
-
<CapRow>
|
|
412
|
+
<CapRow useLegacy className="cap-tag-list-popover-inner">
|
|
408
413
|
<CapSpin tip={formatMessage(messages.gettingTags)} spinning={shouldShowLoading}>
|
|
409
414
|
<Search
|
|
410
415
|
style={{ marginBottom: 8, width: '250px'}}
|
|
@@ -424,7 +429,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
424
429
|
<CapTree
|
|
425
430
|
styling={{height: '350px', overflow: 'auto'}}
|
|
426
431
|
onSelect={this.handleOnSelect}
|
|
427
|
-
selectedKeys={
|
|
432
|
+
selectedKeys={selectedNodeKey ? [selectedNodeKey] : []}
|
|
428
433
|
expandedKeys={expandedKeys}
|
|
429
434
|
autoExpandParent={autoExpandParent}
|
|
430
435
|
onExpand={this.onExpand}
|
|
@@ -439,7 +444,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
439
444
|
size="s"
|
|
440
445
|
/>
|
|
441
446
|
<CapLink>
|
|
442
|
-
<CapButton id="translationtagfooter" type="
|
|
447
|
+
<CapButton id="translationtagfooter" type="link" onClick={this.openTranslationLink}>
|
|
443
448
|
<div className="tag-list-footer-icon">
|
|
444
449
|
<div>{JAPANESE_HELP_TEXT}</div>
|
|
445
450
|
<CapIcon
|
|
@@ -480,7 +485,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
480
485
|
disableTooltipMsg && disabled ? (
|
|
481
486
|
disableTooltipMsg
|
|
482
487
|
) : fetchingSchemaError ? (
|
|
483
|
-
<CapRow className="tooltip-text-container">
|
|
488
|
+
<CapRow useLegacy className="tooltip-text-container">
|
|
484
489
|
<CapLabel className="tooltip-text1">
|
|
485
490
|
{formatMessage(messages.somethingWentWrong)}
|
|
486
491
|
</CapLabel>
|
|
@@ -492,13 +497,13 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
492
497
|
}
|
|
493
498
|
placement="right"
|
|
494
499
|
>
|
|
495
|
-
<CapRow className="tooltip-add-label-container">
|
|
500
|
+
<CapRow useLegacy className="tooltip-add-label-container">
|
|
496
501
|
<CapButton
|
|
497
502
|
disabled={
|
|
498
503
|
this?.props?.disabled || fetchingSchemaError
|
|
499
504
|
}
|
|
500
505
|
isAddBtn
|
|
501
|
-
type="
|
|
506
|
+
type="link"
|
|
502
507
|
>
|
|
503
508
|
{label || ""}
|
|
504
509
|
</CapButton>
|
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
@import "~@capillarytech/cap-ui-library/styles/_variables";
|
|
2
2
|
|
|
3
|
+
.cap-tag-list-popover-inner {
|
|
4
|
+
max-width: 20rem;
|
|
5
|
+
min-width: 0;
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
|
|
8
|
+
.ant-tree.cap-tree-v2.ant-tree-icon-hide {
|
|
9
|
+
width: 100%;
|
|
10
|
+
max-width: 100%;
|
|
11
|
+
|
|
12
|
+
ul {
|
|
13
|
+
max-width: 100%;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
li {
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
max-width: 100%;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
li .ant-tree-node-content-wrapper {
|
|
22
|
+
width: calc(100% - 3.5rem); // leave room for switcher (~24px)
|
|
23
|
+
max-width: calc(100% - 3.5rem);
|
|
24
|
+
overflow: hidden;
|
|
25
|
+
vertical-align: top;
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
text-overflow: ellipsis;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
3
32
|
@media (max-height: 25rem) {
|
|
4
33
|
.ant-tree.cap-tree-v2.ant-tree-icon-hide {
|
|
5
34
|
height: 8.5714rem;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import '@testing-library/jest-dom';
|
|
4
|
+
import { IntlProvider } from 'react-intl';
|
|
5
|
+
import CapTagListWithInput from '../index';
|
|
6
|
+
|
|
7
|
+
const capturedTagListProps = { current: null };
|
|
8
|
+
|
|
9
|
+
jest.mock('../../../v2Containers/TagList', () => {
|
|
10
|
+
const React = require('react');
|
|
11
|
+
const Mock = (props) => {
|
|
12
|
+
capturedTagListProps.current = props;
|
|
13
|
+
return <div data-testid="mock-tag-list">TagList</div>;
|
|
14
|
+
};
|
|
15
|
+
return Mock;
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
jest.mock('@capillarytech/cap-ui-library/CapRow', () => ({ children }) => <div>{children}</div>);
|
|
19
|
+
jest.mock('@capillarytech/cap-ui-library/CapColumn', () => ({ children }) => <div>{children}</div>);
|
|
20
|
+
jest.mock('@capillarytech/cap-ui-library/CapHeading', () => () => null);
|
|
21
|
+
jest.mock('@capillarytech/cap-ui-library/CapInput', () => () => <input data-testid="cap-input" />);
|
|
22
|
+
|
|
23
|
+
const waitMap = {
|
|
24
|
+
b1: { eventName: 'Order Placed', blockName: 'Wait', tags: [] },
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
describe('CapTagListWithInput', () => {
|
|
28
|
+
beforeEach(() => {
|
|
29
|
+
capturedTagListProps.current = null;
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('forwards waitEventContextTags to TagList', () => {
|
|
33
|
+
render(
|
|
34
|
+
<IntlProvider locale="en" messages={{}}>
|
|
35
|
+
<CapTagListWithInput
|
|
36
|
+
inputId="test-url"
|
|
37
|
+
inputOnChange={jest.fn()}
|
|
38
|
+
waitEventContextTags={waitMap}
|
|
39
|
+
onTagSelect={jest.fn()}
|
|
40
|
+
onContextChange={jest.fn()}
|
|
41
|
+
/>
|
|
42
|
+
</IntlProvider>
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
expect(screen.getByTestId('mock-tag-list')).toBeInTheDocument();
|
|
46
|
+
expect(capturedTagListProps.current.waitEventContextTags).toEqual(waitMap);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('uses default empty object for waitEventContextTags when omitted', () => {
|
|
50
|
+
render(
|
|
51
|
+
<IntlProvider locale="en" messages={{}}>
|
|
52
|
+
<CapTagListWithInput
|
|
53
|
+
inputId="test-url"
|
|
54
|
+
inputOnChange={jest.fn()}
|
|
55
|
+
onTagSelect={jest.fn()}
|
|
56
|
+
onContextChange={jest.fn()}
|
|
57
|
+
/>
|
|
58
|
+
</IntlProvider>
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
expect(capturedTagListProps.current.waitEventContextTags).toEqual({});
|
|
62
|
+
});
|
|
63
|
+
});
|
|
@@ -27,6 +27,7 @@ export const CapTagListWithInput = (props) => {
|
|
|
27
27
|
userLocale = 'en',
|
|
28
28
|
eventContextTags = [],
|
|
29
29
|
restrictPersonalization = false,
|
|
30
|
+
waitEventContextTags = {},
|
|
30
31
|
// CapInput props
|
|
31
32
|
inputId,
|
|
32
33
|
inputValue = '',
|
|
@@ -77,6 +78,7 @@ export const CapTagListWithInput = (props) => {
|
|
|
77
78
|
userLocale={userLocale}
|
|
78
79
|
selectedOfferDetails={selectedOfferDetails}
|
|
79
80
|
eventContextTags={eventContextTags}
|
|
81
|
+
waitEventContextTags={waitEventContextTags}
|
|
80
82
|
style={tagListStyle}
|
|
81
83
|
popoverPlacement={popoverPlacement}
|
|
82
84
|
restrictPersonalization={restrictPersonalization}
|
|
@@ -116,6 +118,7 @@ CapTagListWithInput.propTypes = {
|
|
|
116
118
|
userLocale: PropTypes.string,
|
|
117
119
|
eventContextTags: PropTypes.array,
|
|
118
120
|
restrictPersonalization: PropTypes.bool,
|
|
121
|
+
waitEventContextTags: PropTypes.object,
|
|
119
122
|
|
|
120
123
|
// CapInput props
|
|
121
124
|
inputId: PropTypes.string.isRequired,
|
|
@@ -154,6 +157,7 @@ CapTagListWithInput.defaultProps = {
|
|
|
154
157
|
userLocale: 'en',
|
|
155
158
|
eventContextTags: [],
|
|
156
159
|
restrictPersonalization: false,
|
|
160
|
+
waitEventContextTags: {},
|
|
157
161
|
inputValue: '',
|
|
158
162
|
inputSize: 'default',
|
|
159
163
|
inputRequired: false,
|