@capillarytech/creatives-library 9.1.8-alpha.sprint-cap-214249.39 → 9.2.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/constants/unified.js +4 -0
- package/package.json +1 -1
- package/translations/en.json +1 -0
- package/translations/ja-JP.json +1 -0
- package/translations/zh.json +1 -0
- package/utils/common.js +6 -0
- package/utils/createMobilePushPayload.js +33 -50
- package/utils/tagValidations.js +35 -4
- package/utils/templateVarUtils.js +49 -0
- package/utils/tests/createMobilePushPayload.test.js +8 -113
- package/utils/tests/tagValidations.test.js +48 -0
- package/utils/tests/templateVarUtils.test.js +89 -0
- package/v2Components/CapMpushCTA/index.js +9 -10
- package/v2Components/CapMpushCTA/index.scss +3 -29
- package/v2Components/CapTagList/TagFallbackPanel.js +124 -0
- package/v2Components/CapTagList/constants.js +5 -0
- package/v2Components/CapTagList/index.js +46 -7
- package/v2Components/CapTagList/messages.js +44 -0
- package/v2Components/CapTagList/style.scss +113 -1
- package/v2Components/CapTagList/tests/TagFallback.test.js +222 -0
- package/v2Components/CapTagList/utils.js +17 -0
- package/v2Components/CommonTestAndPreview/UnifiedPreview/MobilePushPreviewContent.js +12 -20
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +1 -13
- package/v2Components/CommonTestAndPreview/constants.js +3 -2
- package/v2Components/CommonTestAndPreview/index.js +61 -61
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/MobilePushPreviewContent.test.js +5 -81
- package/v2Components/CommonTestAndPreview/tests/index.test.js +0 -86
- package/v2Components/CommonTestAndPreview/tests/utils.test.js +102 -0
- package/v2Components/CommonTestAndPreview/utils.js +42 -3
- package/v2Components/FormBuilder/Classic.js +24 -14
- package/v2Components/FormBuilder/Functional/channels/mobilepush/config.js +1 -0
- package/v2Components/FormBuilder/Functional/channels/mobilepush/getEditorErrorDescriptor.js +1 -1
- package/v2Components/FormBuilder/Functional/channels/mobilepush/tests/validate.test.js +57 -0
- package/v2Components/FormBuilder/Functional/channels/mobilepush/validate.js +4 -4
- package/v2Components/FormBuilder/Functional/channels/sms/getEditorErrorDescriptor.js +3 -0
- package/v2Components/FormBuilder/Functional/channels/sms/tests/getEditorErrorDescriptor.test.js +5 -0
- package/v2Components/FormBuilder/Functional/channels/sms/tests/validate.test.js +6 -0
- package/v2Components/FormBuilder/Functional/channels/sms/validate.js +3 -1
- package/v2Components/FormBuilder/Functional/renderers/mpushRenderers.js +3 -0
- package/v2Components/FormBuilder/Functional/tests/mpushRenderers.test.js +22 -0
- package/v2Components/TemplatePreview/_templatePreview.scss +2 -12
- package/v2Components/TemplatePreview/index.js +16 -24
- package/v2Components/TemplatePreview/tests/index.test.js +0 -68
- package/v2Containers/Cap/messages.js +4 -0
- package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +1 -0
- 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 +4 -1
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +3 -0
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +2 -0
- package/v2Containers/Line/Container/Text/index.js +3 -1
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +16 -0
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +18 -0
- package/v2Containers/MobilePushNew/components/CtaButtons.js +47 -52
- package/v2Containers/MobilePushNew/components/MediaUploaders.js +216 -297
- package/v2Containers/MobilePushNew/components/PlatformContentFields.js +125 -158
- package/v2Containers/MobilePushNew/components/tests/CtaButtons.test.js +208 -30
- package/v2Containers/MobilePushNew/components/tests/MediaUploaders.test.js +108 -464
- package/v2Containers/MobilePushNew/components/tests/PlatformContentFields.test.js +35 -106
- package/v2Containers/MobilePushNew/constants.js +0 -5
- package/v2Containers/MobilePushNew/hooks/tests/usePlatformSync.test.js +1 -63
- package/v2Containers/MobilePushNew/hooks/tests/useUpload.test.js +0 -52
- package/v2Containers/MobilePushNew/hooks/usePlatformSync.js +1 -40
- package/v2Containers/MobilePushNew/hooks/useUpload.js +39 -29
- package/v2Containers/MobilePushNew/index.js +239 -488
- package/v2Containers/MobilePushNew/index.scss +4 -205
- package/v2Containers/MobilePushNew/messages.js +6 -106
- package/v2Containers/MobilePushNew/tests/index.test.js +1 -469
- package/v2Containers/MobilePushNew/tests/utils.test.js +0 -70
- package/v2Containers/MobilePushNew/utils.js +0 -56
- package/v2Containers/Rcs/index.js +8 -1
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +59 -0
- package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +4 -0
- package/v2Containers/SmsTrai/Edit/index.js +17 -7
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +42 -0
- package/v2Containers/Templates/_templates.scss +2 -10
- package/v2Containers/Templates/index.js +81 -83
- package/v2Containers/Templates/tests/index.test.js +0 -68
- package/v2Containers/Viber/index.js +3 -1
- package/v2Containers/WebPush/Create/utils/validation.js +6 -0
- package/v2Containers/WebPush/Create/utils/validation.test.js +50 -0
- package/v2Containers/Whatsapp/index.js +9 -5
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +2 -2
- package/v2Containers/Zalo/index.js +4 -1
- package/v2Components/CapMpushCTA/tests/index.test.js +0 -89
- package/v2Containers/MobilePushNew/components/TapLinkActions.js +0 -76
|
@@ -341,6 +341,7 @@ exports[`line wrapper test/> should render line component new 1`] = `
|
|
|
341
341
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
342
342
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
343
343
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
344
|
+
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
344
345
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
345
346
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
346
347
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -6677,6 +6678,7 @@ new message content.",
|
|
|
6677
6678
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
6678
6679
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
6679
6680
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
6681
|
+
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
6680
6682
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
6681
6683
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
6682
6684
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -9437,6 +9439,7 @@ exports[`line wrapper test/> should render line component new 2`] = `
|
|
|
9437
9439
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
9438
9440
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
9439
9441
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
9442
|
+
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
9440
9443
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
9441
9444
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
9442
9445
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -15962,6 +15965,7 @@ new message content.",
|
|
|
15962
15965
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
15963
15966
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
15964
15967
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
15968
|
+
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
15965
15969
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
15966
15970
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
15967
15971
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -18722,6 +18726,7 @@ exports[`line wrapper test/> should render line component new 3`] = `
|
|
|
18722
18726
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
18723
18727
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
18724
18728
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
18729
|
+
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
18725
18730
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
18726
18731
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
18727
18732
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -25493,6 +25498,7 @@ new message content.",
|
|
|
25493
25498
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
25494
25499
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
25495
25500
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
25501
|
+
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
25496
25502
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
25497
25503
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
25498
25504
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -28311,6 +28317,7 @@ exports[`line wrapper test/> should render line component new 4`] = `
|
|
|
28311
28317
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
28312
28318
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
28313
28319
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
28320
|
+
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
28314
28321
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
28315
28322
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
28316
28323
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -37303,6 +37310,7 @@ new message content.",
|
|
|
37303
37310
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
37304
37311
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
37305
37312
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
37313
|
+
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
37306
37314
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
37307
37315
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
37308
37316
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -40121,6 +40129,7 @@ exports[`line wrapper test/> should render line component new 5`] = `
|
|
|
40121
40129
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
40122
40130
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
40123
40131
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
40132
|
+
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
40124
40133
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
40125
40134
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
40126
40135
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -49148,6 +49157,7 @@ new message content.",
|
|
|
49148
49157
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
49149
49158
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
49150
49159
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
49160
|
+
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
49151
49161
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
49152
49162
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
49153
49163
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -51966,6 +51976,7 @@ exports[`line wrapper test/> should render line component old 1`] = `
|
|
|
51966
51976
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
51967
51977
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
51968
51978
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
51979
|
+
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
51969
51980
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
51970
51981
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
51971
51982
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -56371,6 +56382,7 @@ new message content.",
|
|
|
56371
56382
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
56372
56383
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
56373
56384
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
56385
|
+
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
56374
56386
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
56375
56387
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
56376
56388
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -59729,6 +59741,7 @@ exports[`line wrapper test/> should render line component old 2`] = `
|
|
|
59729
59741
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
59730
59742
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
59731
59743
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
59744
|
+
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
59732
59745
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
59733
59746
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
59734
59747
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -64557,6 +64570,7 @@ new message content.",
|
|
|
64557
64570
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
64558
64571
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
64559
64572
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
64573
|
+
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
64560
64574
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
64561
64575
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
64562
64576
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -67915,6 +67929,7 @@ exports[`line wrapper test/> should render line component old 3`] = `
|
|
|
67915
67929
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
67916
67930
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
67917
67931
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
67932
|
+
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
67918
67933
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
67919
67934
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
67920
67935
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -72989,6 +73004,7 @@ new message content.",
|
|
|
72989
73004
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
72990
73005
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
72991
73006
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
73007
|
+
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
72992
73008
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
72993
73009
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
72994
73010
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -76405,6 +76421,7 @@ exports[`line wrapper test/> should render line component old 4`] = `
|
|
|
76405
76421
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
76406
76422
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
76407
76423
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
76424
|
+
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
76408
76425
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
76409
76426
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
76410
76427
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -81592,6 +81609,7 @@ new message content.",
|
|
|
81592
81609
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
81593
81610
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
81594
81611
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
81612
|
+
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
81595
81613
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
81596
81614
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
81597
81615
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -5,20 +5,16 @@ import CapRow from "@capillarytech/cap-ui-library/CapRow";
|
|
|
5
5
|
import CapButton from "@capillarytech/cap-ui-library/CapButton";
|
|
6
6
|
import CapIcon from "@capillarytech/cap-ui-library/CapIcon";
|
|
7
7
|
import CapHeading from "@capillarytech/cap-ui-library/CapHeading";
|
|
8
|
-
import
|
|
9
|
-
// import CapTooltip from "@capillarytech/cap-ui-library/CapTooltip";
|
|
8
|
+
import CapTooltip from "@capillarytech/cap-ui-library/CapTooltip";
|
|
10
9
|
import CapMpushCTA from "../../../v2Components/CapMpushCTA";
|
|
11
|
-
import { PRIMARY, DEEP_LINK } from "../constants";
|
|
12
|
-
// import { SECONDARY } from "../constants";
|
|
10
|
+
import { PRIMARY, SECONDARY, DEEP_LINK } from "../constants";
|
|
13
11
|
import messages from "../messages";
|
|
14
12
|
|
|
15
|
-
// Secondary button is commented out below: it needs backend support, so it is being revamped.
|
|
16
|
-
// Restore the commented secondaryButton / setSecondaryButton props, state, handler and JSX together.
|
|
17
13
|
const CtaButtons = ({
|
|
18
14
|
primaryButton,
|
|
19
|
-
|
|
15
|
+
secondaryButton,
|
|
20
16
|
setPrimaryButton,
|
|
21
|
-
|
|
17
|
+
setSecondaryButton,
|
|
22
18
|
ctaData,
|
|
23
19
|
updateHandler,
|
|
24
20
|
deleteHandler,
|
|
@@ -31,7 +27,7 @@ const CtaButtons = ({
|
|
|
31
27
|
}) => {
|
|
32
28
|
// Local state to control CTA form visibility
|
|
33
29
|
const [showPrimaryCTA, setShowPrimaryCTA] = useState(false);
|
|
34
|
-
|
|
30
|
+
const [showSecondaryCTA, setShowSecondaryCTA] = useState(false);
|
|
35
31
|
|
|
36
32
|
const handleAddPrimary = () => {
|
|
37
33
|
// Prevent multiple clicks if primary button is already being added or form is already showing
|
|
@@ -57,67 +53,68 @@ const CtaButtons = ({
|
|
|
57
53
|
setShowPrimaryCTA(true);
|
|
58
54
|
};
|
|
59
55
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
56
|
+
const handleAddSecondary = () => {
|
|
57
|
+
// Prevent multiple clicks if secondary button is already being added or form is already showing
|
|
58
|
+
//cooment until supported from BE & Hydra
|
|
59
|
+
// if (secondaryButton && showSecondaryCTA) {
|
|
60
|
+
// return;
|
|
61
|
+
// }
|
|
62
|
+
|
|
63
|
+
// if (shouldShowSecondaryCTA) {
|
|
64
|
+
// return;
|
|
65
|
+
// }
|
|
66
|
+
|
|
67
|
+
// If ctaData doesn't have a secondary button, initialize it
|
|
68
|
+
if (ctaData?.length < 2 || !ctaData?.find((cta) => cta?.index === 1)) {
|
|
69
|
+
const newSecondaryButton = {
|
|
70
|
+
index: 1,
|
|
71
|
+
ctaType: SECONDARY,
|
|
72
|
+
text: "",
|
|
73
|
+
urlType: DEEP_LINK,
|
|
74
|
+
url: "",
|
|
75
|
+
deepLinkKeys: "",
|
|
76
|
+
isSaved: false,
|
|
77
|
+
};
|
|
78
|
+
updateHandler(newSecondaryButton, 1);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// setSecondaryButton(true);
|
|
82
|
+
// setShowSecondaryCTA(true);
|
|
83
|
+
};
|
|
80
84
|
|
|
81
85
|
// Check if primary button exists (saved or being edited)
|
|
82
86
|
const primaryButtonExists = ctaData?.length > 0 && ctaData[0]?.text;
|
|
83
87
|
const isPrimaryButtonSaved = primaryButtonExists && ctaData[0]?.isSaved;
|
|
84
88
|
|
|
85
|
-
//
|
|
86
|
-
|
|
87
|
-
|
|
89
|
+
// Check if secondary button exists (saved or being edited)
|
|
90
|
+
const secondaryButtonExists = ctaData?.length > 1 && ctaData[1]?.text;
|
|
91
|
+
const isSecondaryButtonSaved = secondaryButtonExists && ctaData[1]?.isSaved;
|
|
88
92
|
|
|
89
93
|
// Show primary CTA if button is active and (form is showing OR button exists)
|
|
90
94
|
const shouldShowPrimaryCTA = primaryButton && (showPrimaryCTA || primaryButtonExists);
|
|
91
95
|
|
|
92
|
-
//
|
|
93
|
-
|
|
96
|
+
// Show secondary CTA if button is active and (form is showing OR button exists)
|
|
97
|
+
const shouldShowSecondaryCTA = secondaryButton && (showSecondaryCTA || secondaryButtonExists);
|
|
94
98
|
|
|
95
99
|
// Enhanced delete handler to hide forms when buttons are deleted
|
|
96
100
|
const handleDelete = (index) => {
|
|
97
101
|
if (index === 0) {
|
|
98
102
|
setShowPrimaryCTA(false);
|
|
99
103
|
setPrimaryButton(false);
|
|
104
|
+
} else if (index === 1) {
|
|
105
|
+
//cooment until supported from BE & Hydra
|
|
106
|
+
// setShowSecondaryCTA(false);
|
|
107
|
+
// setSecondaryButton(false);
|
|
100
108
|
}
|
|
101
|
-
// Secondary button: needs backend support, revamped
|
|
102
|
-
// else if (index === 1) {
|
|
103
|
-
// setShowSecondaryCTA(false);
|
|
104
|
-
// setSecondaryButton(false);
|
|
105
|
-
// }
|
|
106
109
|
deleteHandler(index);
|
|
107
110
|
};
|
|
108
111
|
|
|
109
112
|
return (
|
|
110
113
|
<>
|
|
111
114
|
<CapRow className="mpush-cta-buttons">
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
<FormattedMessage {...messages.buttons} />
|
|
116
|
-
</CapHeading>
|
|
117
|
-
<CapLabel className="optional-text">
|
|
118
|
-
<FormattedMessage {...messages.optionalText} />
|
|
119
|
-
</CapLabel>
|
|
120
|
-
</CapRow>
|
|
115
|
+
<CapHeading type="h3">
|
|
116
|
+
<FormattedMessage {...messages.buttons} />
|
|
117
|
+
</CapHeading>
|
|
121
118
|
{!isPrimaryButtonSaved && !shouldShowPrimaryCTA && (
|
|
122
119
|
<CapButton
|
|
123
120
|
type="link"
|
|
@@ -145,7 +142,6 @@ const CtaButtons = ({
|
|
|
145
142
|
handleOnTagsContextChange={handleOnTagsContextChange}
|
|
146
143
|
/>
|
|
147
144
|
)}
|
|
148
|
-
{/* Secondary button: needs backend support, so it is being revamped. Hidden until then.
|
|
149
145
|
{isPrimaryButtonSaved && !isSecondaryButtonSaved && !shouldShowSecondaryCTA && (
|
|
150
146
|
<CapTooltip
|
|
151
147
|
overlay={<FormattedMessage {...messages.secondaryButtonTooltip} />}
|
|
@@ -175,16 +171,15 @@ const CtaButtons = ({
|
|
|
175
171
|
buttonType={SECONDARY}
|
|
176
172
|
/>
|
|
177
173
|
)}
|
|
178
|
-
*/}
|
|
179
174
|
</>
|
|
180
175
|
);
|
|
181
176
|
};
|
|
182
177
|
|
|
183
178
|
CtaButtons.propTypes = {
|
|
184
179
|
primaryButton: PropTypes.bool.isRequired,
|
|
185
|
-
|
|
180
|
+
secondaryButton: PropTypes.bool.isRequired,
|
|
186
181
|
setPrimaryButton: PropTypes.func.isRequired,
|
|
187
|
-
|
|
182
|
+
setSecondaryButton: PropTypes.func.isRequired,
|
|
188
183
|
ctaData: PropTypes.array.isRequired,
|
|
189
184
|
updateHandler: PropTypes.func.isRequired,
|
|
190
185
|
deleteHandler: PropTypes.func.isRequired,
|