@capillarytech/creatives-library 8.0.319 → 8.0.321
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 +14 -0
- package/package.json +1 -1
- package/utils/templateVarUtils.js +172 -0
- package/utils/tests/tagValidations.test.js +34 -0
- package/utils/tests/templateVarUtils.test.js +160 -0
- package/v2Components/CapTagList/index.js +25 -22
- package/v2Components/CapTagList/style.scss +48 -0
- package/v2Components/CapTagListWithInput/__tests__/CapTagListWithInput.test.js +63 -0
- package/v2Components/CapTagListWithInput/index.js +4 -0
- package/v2Components/CapWhatsappCTA/index.js +2 -0
- package/v2Components/CommonTestAndPreview/CustomValuesEditor.js +70 -49
- package/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +8 -2
- package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +207 -21
- package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +16 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +85 -10
- package/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +30 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +79 -11
- package/v2Components/CommonTestAndPreview/SendTestMessage.js +11 -5
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +20 -1
- package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +133 -4
- package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +12 -0
- package/v2Components/CommonTestAndPreview/constants.js +38 -0
- package/v2Components/CommonTestAndPreview/index.js +693 -155
- package/v2Components/CommonTestAndPreview/messages.js +41 -3
- package/v2Components/CommonTestAndPreview/previewApiUtils.js +59 -0
- package/v2Components/CommonTestAndPreview/sagas.js +15 -6
- package/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +352 -0
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +269 -1
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +118 -5
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +341 -0
- package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +25 -4
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +199 -1
- package/v2Components/CommonTestAndPreview/tests/index.test.js +132 -4
- package/v2Components/CommonTestAndPreview/tests/previewApiUtils.test.js +67 -0
- package/v2Components/CommonTestAndPreview/tests/sagas.test.js +2 -2
- package/v2Components/FormBuilder/index.js +14 -1
- package/v2Components/HtmlEditor/HTMLEditor.js +6 -1
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +1 -0
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +927 -2
- package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +3 -0
- package/v2Components/SmsFallback/SmsFallbackLocalSelector.js +87 -0
- package/v2Components/SmsFallback/constants.js +73 -0
- package/v2Components/SmsFallback/index.js +956 -0
- package/v2Components/SmsFallback/index.scss +265 -0
- package/v2Components/SmsFallback/messages.js +78 -0
- package/v2Components/SmsFallback/smsFallbackUtils.js +107 -0
- package/v2Components/SmsFallback/tests/SmsFallbackLocalSelector.test.js +50 -0
- package/v2Components/SmsFallback/tests/rcsSmsFallback.acceptance.test.js +147 -0
- package/v2Components/SmsFallback/tests/smsFallbackHandlers.test.js +304 -0
- package/v2Components/SmsFallback/tests/smsFallbackUi.test.js +197 -0
- package/v2Components/SmsFallback/tests/smsFallbackUtils.test.js +261 -0
- package/v2Components/SmsFallback/tests/useLocalTemplateList.test.js +422 -0
- package/v2Components/SmsFallback/useLocalTemplateList.js +92 -0
- package/v2Components/TestAndPreviewSlidebox/index.js +8 -1
- package/v2Components/TestAndPreviewSlidebox/sagas.js +11 -4
- package/v2Components/TestAndPreviewSlidebox/tests/saga.test.js +3 -1
- package/v2Components/VarSegmentMessageEditor/constants.js +2 -0
- package/v2Components/VarSegmentMessageEditor/index.js +125 -0
- package/v2Components/VarSegmentMessageEditor/index.scss +46 -0
- package/v2Containers/BeeEditor/index.js +3 -0
- package/v2Containers/CreativesContainer/CreativesSlideBoxWrapper.js +43 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +64 -5
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +10 -1
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +29 -4
- package/v2Containers/CreativesContainer/constants.js +9 -0
- package/v2Containers/CreativesContainer/embeddedSlideboxUtils.js +67 -0
- package/v2Containers/CreativesContainer/index.js +292 -99
- package/v2Containers/CreativesContainer/index.scss +51 -1
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.localTemplates.test.js +90 -0
- package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +104 -0
- package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +110 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +8 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +363 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +20 -10
- package/v2Containers/CreativesContainer/tests/embeddedSlideboxUtils.test.js +258 -0
- package/v2Containers/CreativesContainer/tests/index.test.js +71 -9
- package/v2Containers/CreativesContainer/tests/useLocalTemplatesProp.test.js +125 -0
- package/v2Containers/Email/index.js +1 -0
- package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +7 -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/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +19 -0
- package/v2Containers/InAppWrapper/hooks/useInAppWrapper.js +3 -0
- package/v2Containers/InAppWrapper/index.js +3 -0
- package/v2Containers/MobilePush/Create/index.js +2 -0
- package/v2Containers/MobilePush/Edit/index.js +2 -0
- package/v2Containers/MobilepushWrapper/index.js +3 -1
- package/v2Containers/Rcs/constants.js +32 -1
- package/v2Containers/Rcs/index.js +951 -873
- package/v2Containers/Rcs/index.scss +85 -6
- package/v2Containers/Rcs/messages.js +10 -1
- package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +205 -0
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +40834 -1963
- package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap +0 -5
- package/v2Containers/Rcs/tests/index.test.js +41 -38
- package/v2Containers/Rcs/tests/mockData.js +38 -0
- package/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +251 -0
- package/v2Containers/Rcs/tests/utils.test.js +379 -1
- package/v2Containers/Rcs/utils.js +358 -10
- package/v2Containers/Sms/Create/index.js +83 -36
- package/v2Containers/Sms/Edit/index.js +2 -0
- package/v2Containers/Sms/smsFormDataHelpers.js +67 -0
- package/v2Containers/Sms/tests/smsFormDataHelpers.test.js +253 -0
- package/v2Containers/SmsTrai/Create/index.js +9 -4
- package/v2Containers/SmsTrai/Edit/constants.js +2 -0
- package/v2Containers/SmsTrai/Edit/index.js +611 -128
- package/v2Containers/SmsTrai/Edit/index.scss +121 -0
- package/v2Containers/SmsTrai/Edit/messages.js +9 -4
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4327 -2374
- package/v2Containers/SmsWrapper/index.js +39 -8
- package/v2Containers/TagList/index.js +47 -2
- package/v2Containers/TagList/messages.js +4 -0
- package/v2Containers/TagList/tests/TagList.test.js +122 -20
- package/v2Containers/TagList/tests/mockdata.js +17 -0
- package/v2Containers/Templates/TemplatesActionBar.js +101 -0
- package/v2Containers/Templates/_templates.scss +61 -2
- package/v2Containers/Templates/actions.js +11 -0
- package/v2Containers/Templates/constants.js +2 -0
- package/v2Containers/Templates/index.js +90 -40
- package/v2Containers/Templates/sagas.js +57 -12
- package/v2Containers/Templates/tests/TemplatesActionBar.test.js +120 -0
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1043 -1079
- package/v2Containers/Templates/tests/sagas.test.js +193 -12
- package/v2Containers/Templates/tests/smsTemplatesListApi.test.js +180 -0
- package/v2Containers/Templates/utils/smsTemplatesListApi.js +79 -0
- package/v2Containers/TemplatesV2/TemplatesV2.style.js +72 -1
- package/v2Containers/TemplatesV2/index.js +86 -23
- package/v2Containers/TemplatesV2/tests/TemplatesV2.localTemplates.test.js +131 -0
- package/v2Containers/Viber/index.js +5 -0
- package/v2Containers/WebPush/Create/hooks/useTagManagement.js +0 -2
- package/v2Containers/WebPush/Create/index.js +9 -1
- package/v2Containers/Whatsapp/index.js +8 -20
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +598 -34
- package/v2Containers/Zalo/index.js +2 -0
|
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import get from 'lodash/get';
|
|
5
5
|
import isEmpty from 'lodash/isEmpty';
|
|
6
|
+
import pick from 'lodash/pick';
|
|
6
7
|
import cloneDeep from 'lodash/cloneDeep';
|
|
7
8
|
import TemplatesV2 from '../TemplatesV2';
|
|
8
9
|
import TemplatePreview from '../../v2Components/TemplatePreview';
|
|
@@ -25,6 +26,7 @@ import Viber from '../Viber';
|
|
|
25
26
|
import Whatsapp from '../Whatsapp';
|
|
26
27
|
import InApp from '../InApp';
|
|
27
28
|
import Rcs from '../Rcs';
|
|
29
|
+
import { isRcsTextOnlyCardMediaType, resolveRcsCardPreviewStrings } from '../Rcs/utils';
|
|
28
30
|
import { getWhatsappContent } from '../Whatsapp/utils';
|
|
29
31
|
import * as commonUtil from '../../utils/common';
|
|
30
32
|
import Zalo from '../Zalo';
|
|
@@ -168,6 +170,7 @@ export function SlideBoxContent(props) {
|
|
|
168
170
|
creativesMode,
|
|
169
171
|
hostName = '',
|
|
170
172
|
eventContextTags,
|
|
173
|
+
waitEventContextTags,
|
|
171
174
|
isLoyaltyModule,
|
|
172
175
|
loyaltyMetaData = {},
|
|
173
176
|
showTestAndPreviewSlidebox,
|
|
@@ -179,6 +182,8 @@ export function SlideBoxContent(props) {
|
|
|
179
182
|
isTestAndPreviewMode,
|
|
180
183
|
onHtmlEditorValidationStateChange,
|
|
181
184
|
} = props;
|
|
185
|
+
const localTemplatesConfig = props.localTemplatesConfig || pick(props, constants.LOCAL_TEMPLATE_CONFIG_KEYS);
|
|
186
|
+
const useLocalTemplates = !!get(localTemplatesConfig, 'useLocalTemplates');
|
|
182
187
|
const type = (messageDetails.type || '').toLowerCase(); // type is context in get tags values : outbound | dvs | referral | loyalty | coupons
|
|
183
188
|
const query = { type: !isFullMode && 'embedded', module: isFullMode ? 'default' : 'library', isEditFromCampaigns: (templateData || {}).isEditFromCampaigns};
|
|
184
189
|
const creativesLocationProps = {
|
|
@@ -398,12 +403,37 @@ export function SlideBoxContent(props) {
|
|
|
398
403
|
}
|
|
399
404
|
case constants.RCS: {
|
|
400
405
|
const template = cloneDeep(templateDataObject);
|
|
401
|
-
const
|
|
406
|
+
const cardPath = 'versions.base.content.RCS.rcsContent.cardContent[0]';
|
|
407
|
+
const card = get(template, cardPath, {}) || {};
|
|
408
|
+
const {
|
|
409
|
+
description = '',
|
|
410
|
+
media: { mediaUrl = '' } = {},
|
|
411
|
+
title = '',
|
|
412
|
+
mediaType: cardMediaType,
|
|
413
|
+
suggestions = [],
|
|
414
|
+
cardVarMapped: nestedCardVarMapped,
|
|
415
|
+
} = card;
|
|
416
|
+
const rootMirror = templateDataObject?.rcsCardVarMapped;
|
|
417
|
+
const nestedRecord =
|
|
418
|
+
nestedCardVarMapped != null && typeof nestedCardVarMapped === 'object'
|
|
419
|
+
? nestedCardVarMapped
|
|
420
|
+
: {};
|
|
421
|
+
const rootRecord =
|
|
422
|
+
rootMirror != null && typeof rootMirror === 'object' ? rootMirror : {};
|
|
423
|
+
const mergedCardVarMapped = { ...rootRecord, ...nestedRecord };
|
|
424
|
+
const textOnlyCard = isRcsTextOnlyCardMediaType(cardMediaType);
|
|
425
|
+
const { rcsTitle, rcsDesc } = resolveRcsCardPreviewStrings(
|
|
426
|
+
title,
|
|
427
|
+
description,
|
|
428
|
+
mergedCardVarMapped,
|
|
429
|
+
!isFullMode,
|
|
430
|
+
textOnlyCard,
|
|
431
|
+
);
|
|
402
432
|
return {
|
|
403
433
|
rcsPreviewContent: {
|
|
404
434
|
rcsImageSrc: mediaUrl,
|
|
405
|
-
rcsTitle
|
|
406
|
-
rcsDesc
|
|
435
|
+
rcsTitle,
|
|
436
|
+
rcsDesc,
|
|
407
437
|
...(suggestions.length > 0 && {
|
|
408
438
|
buttonText: suggestions[0]?.text,
|
|
409
439
|
}),
|
|
@@ -424,11 +454,12 @@ export function SlideBoxContent(props) {
|
|
|
424
454
|
selectedOfferDetails,
|
|
425
455
|
getFormData,
|
|
426
456
|
eventContextTags,
|
|
457
|
+
waitEventContextTags,
|
|
427
458
|
};
|
|
428
459
|
|
|
429
460
|
return (
|
|
430
461
|
<CreativesWrapper>
|
|
431
|
-
{
|
|
462
|
+
{slidBoxContent === 'templates' && (!isFullMode || useLocalTemplates) && (
|
|
432
463
|
<TemplatesV2
|
|
433
464
|
isFullMode={isFullMode}
|
|
434
465
|
onSelectTemplate={onSelectTemplate}
|
|
@@ -458,8 +489,10 @@ export function SlideBoxContent(props) {
|
|
|
458
489
|
enableNewChannels={enableNewChannels}
|
|
459
490
|
hideTestAndPreviewBtn={hideTestAndPreviewBtn}
|
|
460
491
|
eventContextTags={eventContextTags}
|
|
492
|
+
waitEventContextTags={waitEventContextTags}
|
|
461
493
|
loyaltyMetaData={loyaltyMetaData}
|
|
462
494
|
isLoyaltyModule={isLoyaltyModule}
|
|
495
|
+
localTemplatesConfig={localTemplatesConfig}
|
|
463
496
|
/>
|
|
464
497
|
)}
|
|
465
498
|
{isPreview && (
|
|
@@ -561,6 +594,7 @@ export function SlideBoxContent(props) {
|
|
|
561
594
|
onCreateComplete={onCreateComplete}
|
|
562
595
|
smsRegister={smsRegister}
|
|
563
596
|
eventContextTags={eventContextTags}
|
|
597
|
+
waitEventContextTags={waitEventContextTags}
|
|
564
598
|
getLiquidTags={getLiquidTags}
|
|
565
599
|
showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
|
|
566
600
|
handleTestAndPreview={handleTestAndPreview}
|
|
@@ -604,6 +638,7 @@ export function SlideBoxContent(props) {
|
|
|
604
638
|
}}
|
|
605
639
|
hostName={hostName}
|
|
606
640
|
eventContextTags={eventContextTags}
|
|
641
|
+
waitEventContextTags={waitEventContextTags}
|
|
607
642
|
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
608
643
|
showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
|
|
609
644
|
handleTestAndPreview={handleTestAndPreview}
|
|
@@ -628,6 +663,7 @@ export function SlideBoxContent(props) {
|
|
|
628
663
|
route={{ name: 'sms' }}
|
|
629
664
|
isCreateSms={isCreateSms}
|
|
630
665
|
isComponent
|
|
666
|
+
templateData={templateData}
|
|
631
667
|
isGetFormData={isGetFormData}
|
|
632
668
|
getFormSubscriptionData={getFormData}
|
|
633
669
|
getLiquidTags={getLiquidTags}
|
|
@@ -644,6 +680,7 @@ export function SlideBoxContent(props) {
|
|
|
644
680
|
eventContextTags={eventContextTags}
|
|
645
681
|
restrictPersonalization={restrictPersonalization}
|
|
646
682
|
isAnonymousType={isAnonymousType}
|
|
683
|
+
waitEventContextTags={waitEventContextTags}
|
|
647
684
|
/>
|
|
648
685
|
)}
|
|
649
686
|
|
|
@@ -677,6 +714,7 @@ export function SlideBoxContent(props) {
|
|
|
677
714
|
moduleType={moduleType}
|
|
678
715
|
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
679
716
|
eventContextTags={eventContextTags}
|
|
717
|
+
waitEventContextTags={waitEventContextTags}
|
|
680
718
|
isLoyaltyModule={isLoyaltyModule}
|
|
681
719
|
showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
|
|
682
720
|
handleTestAndPreview={handleTestAndPreview}
|
|
@@ -721,6 +759,7 @@ export function SlideBoxContent(props) {
|
|
|
721
759
|
moduleType={moduleType}
|
|
722
760
|
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
723
761
|
eventContextTags={eventContextTags}
|
|
762
|
+
waitEventContextTags={waitEventContextTags}
|
|
724
763
|
isLoyaltyModule={isLoyaltyModule}
|
|
725
764
|
showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
|
|
726
765
|
handleTestAndPreview={handleTestAndPreview}
|
|
@@ -760,6 +799,7 @@ export function SlideBoxContent(props) {
|
|
|
760
799
|
moduleType={moduleType}
|
|
761
800
|
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
762
801
|
eventContextTags={eventContextTags}
|
|
802
|
+
waitEventContextTags={waitEventContextTags}
|
|
763
803
|
isLoyaltyModule={isLoyaltyModule}
|
|
764
804
|
showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
|
|
765
805
|
handleTestAndPreview={handleTestAndPreview}
|
|
@@ -803,6 +843,7 @@ export function SlideBoxContent(props) {
|
|
|
803
843
|
hideTestAndPreviewBtn={hideTestAndPreviewBtn}
|
|
804
844
|
creativesMode={creativesMode}
|
|
805
845
|
eventContextTags={eventContextTags}
|
|
846
|
+
waitEventContextTags={waitEventContextTags}
|
|
806
847
|
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
807
848
|
showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
|
|
808
849
|
handleTestAndPreview={handleTestAndPreview}
|
|
@@ -835,6 +876,7 @@ export function SlideBoxContent(props) {
|
|
|
835
876
|
hideTestAndPreviewBtn={hideTestAndPreviewBtn}
|
|
836
877
|
creativesMode={creativesMode}
|
|
837
878
|
eventContextTags={eventContextTags}
|
|
879
|
+
waitEventContextTags={waitEventContextTags}
|
|
838
880
|
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
839
881
|
handleClose={handleClose}
|
|
840
882
|
restrictPersonalization={restrictPersonalization}
|
|
@@ -874,6 +916,7 @@ export function SlideBoxContent(props) {
|
|
|
874
916
|
hideTestAndPreviewBtn={hideTestAndPreviewBtn}
|
|
875
917
|
onTestContentClicked={onTestContentClicked}
|
|
876
918
|
eventContextTags={eventContextTags}
|
|
919
|
+
waitEventContextTags={waitEventContextTags}
|
|
877
920
|
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
878
921
|
showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
|
|
879
922
|
handleTestAndPreview={handleTestAndPreview}
|
|
@@ -912,6 +955,7 @@ export function SlideBoxContent(props) {
|
|
|
912
955
|
hideTestAndPreviewBtn={hideTestAndPreviewBtn}
|
|
913
956
|
onTestContentClicked={onTestContentClicked}
|
|
914
957
|
eventContextTags={eventContextTags}
|
|
958
|
+
waitEventContextTags={waitEventContextTags}
|
|
915
959
|
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
916
960
|
onCreateComplete={onCreateComplete}
|
|
917
961
|
creativesMode={creativesMode}
|
|
@@ -937,6 +981,7 @@ export function SlideBoxContent(props) {
|
|
|
937
981
|
onSelectTemplate={onSelectTemplate}
|
|
938
982
|
orgUnitId={orgUnitId}
|
|
939
983
|
eventContextTags={eventContextTags}
|
|
984
|
+
waitEventContextTags={waitEventContextTags}
|
|
940
985
|
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
941
986
|
/>
|
|
942
987
|
)
|
|
@@ -958,6 +1003,7 @@ export function SlideBoxContent(props) {
|
|
|
958
1003
|
fbAdManager={fbAdManager}
|
|
959
1004
|
onSelectTemplate={onSelectTemplate}
|
|
960
1005
|
eventContextTags={eventContextTags}
|
|
1006
|
+
waitEventContextTags={waitEventContextTags}
|
|
961
1007
|
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
962
1008
|
/>
|
|
963
1009
|
)
|
|
@@ -981,6 +1027,7 @@ export function SlideBoxContent(props) {
|
|
|
981
1027
|
handleClose={handleClose}
|
|
982
1028
|
selectedOfferDetails={selectedOfferDetails}
|
|
983
1029
|
eventContextTags={eventContextTags}
|
|
1030
|
+
waitEventContextTags={waitEventContextTags}
|
|
984
1031
|
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
985
1032
|
/>
|
|
986
1033
|
)
|
|
@@ -1001,6 +1048,7 @@ export function SlideBoxContent(props) {
|
|
|
1001
1048
|
handleClose={handleClose}
|
|
1002
1049
|
selectedOfferDetails={selectedOfferDetails}
|
|
1003
1050
|
eventContextTags={eventContextTags}
|
|
1051
|
+
waitEventContextTags={waitEventContextTags}
|
|
1004
1052
|
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
1005
1053
|
/>
|
|
1006
1054
|
)
|
|
@@ -1017,6 +1065,7 @@ export function SlideBoxContent(props) {
|
|
|
1017
1065
|
templateData={templateData}
|
|
1018
1066
|
selectedOfferDetails={selectedOfferDetails}
|
|
1019
1067
|
eventContextTags={eventContextTags}
|
|
1068
|
+
waitEventContextTags={waitEventContextTags}
|
|
1020
1069
|
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
1021
1070
|
showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
|
|
1022
1071
|
handleTestAndPreview={handleTestAndPreview}
|
|
@@ -1041,6 +1090,7 @@ export function SlideBoxContent(props) {
|
|
|
1041
1090
|
handleTestAndPreview={handleTestAndPreview}
|
|
1042
1091
|
handleCloseTestAndPreview={handleCloseTestAndPreview}
|
|
1043
1092
|
eventContextTags={eventContextTags}
|
|
1093
|
+
waitEventContextTags={waitEventContextTags}
|
|
1044
1094
|
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
1045
1095
|
createNew/> }
|
|
1046
1096
|
|
|
@@ -1048,6 +1098,7 @@ export function SlideBoxContent(props) {
|
|
|
1048
1098
|
isFullMode={isFullMode}
|
|
1049
1099
|
onCreateComplete={onCreateComplete}
|
|
1050
1100
|
eventContextTags={eventContextTags}
|
|
1101
|
+
waitEventContextTags={waitEventContextTags}
|
|
1051
1102
|
handleClose={handleClose}
|
|
1052
1103
|
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
1053
1104
|
showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
|
|
@@ -1065,6 +1116,7 @@ export function SlideBoxContent(props) {
|
|
|
1065
1116
|
forwardedTags={forwardedTags}
|
|
1066
1117
|
selectedOfferDetails={selectedOfferDetails}
|
|
1067
1118
|
eventContextTags={eventContextTags}
|
|
1119
|
+
waitEventContextTags={waitEventContextTags}
|
|
1068
1120
|
showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
|
|
1069
1121
|
handleTestAndPreview={handleTestAndPreview}
|
|
1070
1122
|
handleCloseTestAndPreview={handleCloseTestAndPreview}
|
|
@@ -1103,6 +1155,7 @@ export function SlideBoxContent(props) {
|
|
|
1103
1155
|
onPreviewContentClicked={onPreviewContentClicked}
|
|
1104
1156
|
onTestContentClicked={onTestContentClicked}
|
|
1105
1157
|
eventContextTags={eventContextTags}
|
|
1158
|
+
waitEventContextTags={waitEventContextTags}
|
|
1106
1159
|
onCreateComplete={onCreateComplete}
|
|
1107
1160
|
handleClose={handleClose}
|
|
1108
1161
|
moduleType={moduleType}
|
|
@@ -1138,6 +1191,7 @@ export function SlideBoxContent(props) {
|
|
|
1138
1191
|
moduleType={moduleType}
|
|
1139
1192
|
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
1140
1193
|
eventContextTags={eventContextTags}
|
|
1194
|
+
waitEventContextTags={waitEventContextTags}
|
|
1141
1195
|
onCreateComplete={onCreateComplete}
|
|
1142
1196
|
handleClose={handleClose}
|
|
1143
1197
|
getDefaultTags={type}
|
|
@@ -1161,6 +1215,7 @@ export function SlideBoxContent(props) {
|
|
|
1161
1215
|
onCreateComplete={onCreateComplete}
|
|
1162
1216
|
selectedOfferDetails={selectedOfferDetails}
|
|
1163
1217
|
eventContextTags={eventContextTags}
|
|
1218
|
+
waitEventContextTags={waitEventContextTags}
|
|
1164
1219
|
params={{
|
|
1165
1220
|
id: templateData._id,
|
|
1166
1221
|
}}
|
|
@@ -1199,10 +1254,12 @@ export function SlideBoxContent(props) {
|
|
|
1199
1254
|
eventContextTags={eventContextTags}
|
|
1200
1255
|
restrictPersonalization={restrictPersonalization}
|
|
1201
1256
|
isAnonymousType={isAnonymousType}
|
|
1257
|
+
waitEventContextTags={waitEventContextTags}
|
|
1202
1258
|
/>
|
|
1203
1259
|
)}
|
|
1204
1260
|
{isCreateRcs && (<Rcs
|
|
1205
1261
|
{...rcsCommonProps}
|
|
1262
|
+
templateData={templateData}
|
|
1206
1263
|
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
1207
1264
|
showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
|
|
1208
1265
|
handleTestAndPreview={handleTestAndPreview}
|
|
@@ -1292,6 +1349,8 @@ SlideBoxContent.propTypes = {
|
|
|
1292
1349
|
showTestAndPreviewSlidebox: PropTypes.bool,
|
|
1293
1350
|
handleTestAndPreview: PropTypes.func,
|
|
1294
1351
|
handleCloseTestAndPreview: PropTypes.func,
|
|
1295
|
-
isTestAndPreviewMode: PropTypes.bool
|
|
1352
|
+
isTestAndPreviewMode: PropTypes.bool,
|
|
1353
|
+
waitEventContextTags: PropTypes.object,
|
|
1354
|
+
eventContextTags: PropTypes.array,
|
|
1296
1355
|
};
|
|
1297
1356
|
export default SlideBoxContent;
|
|
@@ -48,6 +48,8 @@ function SlideBoxFooter(props) {
|
|
|
48
48
|
isAnonymousType = false,
|
|
49
49
|
templateData = {},
|
|
50
50
|
hasPersonalizationTokenError: hasPersonalizationTokenErrorProp = false,
|
|
51
|
+
/** When set (e.g. SMS library create), overrides `creativesTemplatesSave` (“Done”) for the primary button */
|
|
52
|
+
primarySaveButtonMessage,
|
|
51
53
|
} = props;
|
|
52
54
|
// Calculate if buttons should be disabled
|
|
53
55
|
// Only apply validation state checks for EMAIL channel in HTML Editor mode (not BEE/DragDrop)
|
|
@@ -186,7 +188,9 @@ function SlideBoxFooter(props) {
|
|
|
186
188
|
onClick={onSave}
|
|
187
189
|
disabled={isTemplateNameEmpty || fetchingCmsData || shouldDisableButtons || hasPersonalizationTokenError}
|
|
188
190
|
>
|
|
189
|
-
{
|
|
191
|
+
{primarySaveButtonMessage ? (
|
|
192
|
+
<FormattedMessage {...primarySaveButtonMessage} />
|
|
193
|
+
) : isFullMode ? (
|
|
190
194
|
getFullModeSaveBtn(slidBoxContent, isCreatingTemplate)
|
|
191
195
|
) : (
|
|
192
196
|
<FormattedMessage {...messages.creativesTemplatesSave} />
|
|
@@ -262,6 +266,10 @@ SlideBoxFooter.propTypes = {
|
|
|
262
266
|
templateData: PropTypes.object,
|
|
263
267
|
formData: PropTypes.array,
|
|
264
268
|
hasPersonalizationTokenError: PropTypes.bool,
|
|
269
|
+
primarySaveButtonMessage: PropTypes.shape({
|
|
270
|
+
id: PropTypes.string,
|
|
271
|
+
defaultMessage: PropTypes.string,
|
|
272
|
+
}),
|
|
265
273
|
};
|
|
266
274
|
|
|
267
275
|
SlideBoxFooter.defaultProps = {
|
|
@@ -289,5 +297,6 @@ SlideBoxFooter.defaultProps = {
|
|
|
289
297
|
selectedEmailCreateMode: '',
|
|
290
298
|
formData: [],
|
|
291
299
|
hasPersonalizationTokenError: false,
|
|
300
|
+
primarySaveButtonMessage: undefined,
|
|
292
301
|
};
|
|
293
302
|
export default SlideBoxFooter;
|
|
@@ -16,6 +16,7 @@ import { isTraiDLTEnable } from '../../utils/common';
|
|
|
16
16
|
import { formatString } from '../../utils/Formatter';
|
|
17
17
|
import {
|
|
18
18
|
CAP_SPACE_12,
|
|
19
|
+
CAP_SPACE_16,
|
|
19
20
|
} from '@capillarytech/cap-ui-library/styled/variables';
|
|
20
21
|
import { WHATSAPP_HELP_DOC_LINK, JOURNEY } from './constants';
|
|
21
22
|
|
|
@@ -24,7 +25,7 @@ const StyledLabel = styled(CapLabelInline)`
|
|
|
24
25
|
margin-right: ${CAP_SPACE_12};
|
|
25
26
|
`;
|
|
26
27
|
const PrefixWrapper = styled.div`
|
|
27
|
-
margin-right:
|
|
28
|
+
margin-right: ${CAP_SPACE_16};
|
|
28
29
|
`;
|
|
29
30
|
const renderData = (type, value, channel) => (
|
|
30
31
|
<StyledLabel className={channel?.toLowerCase() === ZALO ? 'zalo-template-name-spacing' : ''} type={type}>
|
|
@@ -33,7 +34,25 @@ const renderData = (type, value, channel) => (
|
|
|
33
34
|
);
|
|
34
35
|
|
|
35
36
|
export function SlideBoxHeader(props) {
|
|
36
|
-
const {
|
|
37
|
+
const {
|
|
38
|
+
slidBoxContent,
|
|
39
|
+
templateData,
|
|
40
|
+
onShowTemplates,
|
|
41
|
+
creativesMode,
|
|
42
|
+
isFullMode,
|
|
43
|
+
showPrefix,
|
|
44
|
+
shouldShowTemplateName,
|
|
45
|
+
channel,
|
|
46
|
+
templateNameRenderProp,
|
|
47
|
+
weChatTemplateType,
|
|
48
|
+
onWeChatMaptemplateStepChange,
|
|
49
|
+
weChatMaptemplateStep,
|
|
50
|
+
templateStep,
|
|
51
|
+
smsRegister,
|
|
52
|
+
handleClose,
|
|
53
|
+
moduleType,
|
|
54
|
+
useLocalTemplates = false,
|
|
55
|
+
} = props;
|
|
37
56
|
const showTemplateNameHeader = isFullMode && shouldShowTemplateName;
|
|
38
57
|
const mapTemplateCreate = !showTemplateNameHeader && slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
|
|
39
58
|
const isTraiDlt = isTraiDLTEnable(isFullMode, smsRegister);
|
|
@@ -81,6 +100,9 @@ export function SlideBoxHeader(props) {
|
|
|
81
100
|
window.open(WHATSAPP_HELP_DOC_LINK, '_blank');
|
|
82
101
|
};
|
|
83
102
|
|
|
103
|
+
const showCreativesTemplatesBackButton =
|
|
104
|
+
!isFullMode && (moduleType === JOURNEY || useLocalTemplates);
|
|
105
|
+
|
|
84
106
|
return (
|
|
85
107
|
<div key="creatives-container-slidebox-header-content">
|
|
86
108
|
{slidBoxContent === 'templates' && !showTemplateNameHeader && (
|
|
@@ -89,7 +111,7 @@ export function SlideBoxHeader(props) {
|
|
|
89
111
|
description={![NO_COMMUNICATION, FTP].includes(channel) &&
|
|
90
112
|
<FormattedMessage {...messages.creativeTemplatesDesc} />
|
|
91
113
|
}
|
|
92
|
-
prefix={
|
|
114
|
+
prefix={showCreativesTemplatesBackButton &&
|
|
93
115
|
<PrefixWrapper>
|
|
94
116
|
<CapIcons.backIcon onClick={handleClose} />
|
|
95
117
|
</PrefixWrapper>
|
|
@@ -135,7 +157,7 @@ export function SlideBoxHeader(props) {
|
|
|
135
157
|
}
|
|
136
158
|
</>
|
|
137
159
|
}
|
|
138
|
-
prefix={
|
|
160
|
+
prefix={!isFullMode && showPrefix &&
|
|
139
161
|
<PrefixWrapper>
|
|
140
162
|
<CapIcons.backIcon onClick={onShowTemplates} />
|
|
141
163
|
</PrefixWrapper>
|
|
@@ -191,5 +213,8 @@ SlideBoxHeader.propTypes = {
|
|
|
191
213
|
shouldShowTemplateName: PropTypes.bool,
|
|
192
214
|
templateNameRenderProp: PropTypes.func,
|
|
193
215
|
smsRegister: PropTypes.any,
|
|
216
|
+
handleClose: PropTypes.func,
|
|
217
|
+
moduleType: PropTypes.string,
|
|
218
|
+
useLocalTemplates: PropTypes.bool,
|
|
194
219
|
};
|
|
195
220
|
export default SlideBoxHeader;
|
|
@@ -67,3 +67,12 @@ export const ALLOWED_CHANNELS_FOR_ANONYMOUS = ['mobilepush', 'webpush'];
|
|
|
67
67
|
export const ALL_CHANNELS_NEW = [
|
|
68
68
|
'sms', 'email', 'whatsapp', 'facebook', 'line', 'viber', 'rcs', 'zalo', 'inapp', 'call_task', 'ftp',
|
|
69
69
|
];
|
|
70
|
+
|
|
71
|
+
export const LOCAL_TEMPLATE_CONFIG_KEYS = ['useLocalTemplates', 'localTemplates', 'localTemplatesLoading', 'localTemplatesFilterContent', 'localTemplatesUseSkeleton', 'localTemplatesOnPageChange'];
|
|
72
|
+
|
|
73
|
+
/** Keys passed from parents into `Templates` when using local SMS template list (extends `LOCAL_TEMPLATE_CONFIG_KEYS`). */
|
|
74
|
+
export const LOCAL_TEMPLATE_CONFIG_KEYS_FOR_PICK = [
|
|
75
|
+
...LOCAL_TEMPLATE_CONFIG_KEYS,
|
|
76
|
+
'localTemplatesLoadingTip',
|
|
77
|
+
'localTemplatesFooterContent',
|
|
78
|
+
];
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared logic for CreativesContainer slidebox + embedded flows (e.g. RCS SMS fallback)
|
|
3
|
+
* that mirror the same footer liquid errors and layout margins.
|
|
4
|
+
*/
|
|
5
|
+
import get from 'lodash/get';
|
|
6
|
+
import {
|
|
7
|
+
CAP_SPACE_32,
|
|
8
|
+
CAP_SPACE_56,
|
|
9
|
+
CAP_SPACE_64,
|
|
10
|
+
} from '@capillarytech/cap-ui-library/styled/variables';
|
|
11
|
+
import * as constants from './constants';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Returns true if value is "deep empty": no errors present.
|
|
15
|
+
* Same rules as CreativesContainer (used for liquid / standard error payloads).
|
|
16
|
+
*/
|
|
17
|
+
export function isDeepEmpty(value) {
|
|
18
|
+
if (value == null) return true;
|
|
19
|
+
if (typeof value === 'string') return value.length === 0;
|
|
20
|
+
if (Array.isArray(value)) return value.length === 0;
|
|
21
|
+
if (typeof value === 'object') {
|
|
22
|
+
return Object.values(value).every(isDeepEmpty);
|
|
23
|
+
}
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Header/content margin below slidebox chrome when ErrorInfoNote stacks errors — same formula as CreativesContainer#render.
|
|
29
|
+
*/
|
|
30
|
+
export function getSlideBoxWrapperMarginFromLiquidErrors(liquidErrorMessage) {
|
|
31
|
+
return (get(liquidErrorMessage, 'STANDARD_ERROR_MSG.length', 0) > 0
|
|
32
|
+
&& get(liquidErrorMessage, 'LIQUID_ERROR_MSG.length', 0) > 0)
|
|
33
|
+
? CAP_SPACE_64
|
|
34
|
+
: get(liquidErrorMessage, 'LIQUID_ERROR_MSG.length', 0) > 0
|
|
35
|
+
? CAP_SPACE_56
|
|
36
|
+
: get(liquidErrorMessage, 'STANDARD_ERROR_MSG.length', 0) > 0
|
|
37
|
+
? CAP_SPACE_32
|
|
38
|
+
: 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Maps FormBuilder `showLiquidErrorInFooter` args to slidebox footer state.
|
|
43
|
+
* Returns `null` when CreativesContainer intentionally skips updating (Mobile Push OLD empty clear).
|
|
44
|
+
*/
|
|
45
|
+
export function computeLiquidFooterUpdateFromFormBuilder(
|
|
46
|
+
errorMessagesFromFormBuilder,
|
|
47
|
+
currentFormBuilderTab,
|
|
48
|
+
{ previousIsLiquidValidationError, currentChannelUpper } = {},
|
|
49
|
+
) {
|
|
50
|
+
const liquidMsgs = get(errorMessagesFromFormBuilder, constants.LIQUID_ERROR_MSG, []);
|
|
51
|
+
const standardMsgs = get(errorMessagesFromFormBuilder, constants.STANDARD_ERROR_MSG, []);
|
|
52
|
+
const hasLiquid = !isDeepEmpty(liquidMsgs);
|
|
53
|
+
const hasStandard = !isDeepEmpty(standardMsgs);
|
|
54
|
+
const isLiquidValidationError = hasLiquid || hasStandard;
|
|
55
|
+
const isMobilePush = currentChannelUpper === constants.MOBILE_PUSH;
|
|
56
|
+
if (!hasLiquid && !hasStandard && previousIsLiquidValidationError && isMobilePush) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
isLiquidValidationError,
|
|
61
|
+
liquidErrorMessage: errorMessagesFromFormBuilder,
|
|
62
|
+
activeFormBuilderTab:
|
|
63
|
+
currentFormBuilderTab === 1
|
|
64
|
+
? constants.ANDROID
|
|
65
|
+
: (currentFormBuilderTab === 2 ? constants.IOS : null),
|
|
66
|
+
};
|
|
67
|
+
}
|