@capillarytech/creatives-library 8.0.120 → 8.0.122-alpha.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/containers/MobilePush/Create/_mobilePushCreate.scss +5 -3
- package/containers/MobilePush/Edit/_mobilePushCreate.scss +5 -3
- package/containers/Sms/Create/_smsCreate.scss +8 -5
- package/package.json +1 -1
- package/v2Components/mockdata.js +2 -2
- package/v2Containers/Whatsapp/index.js +31 -22
- package/v2Containers/Whatsapp/messages.js +14 -11
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +6 -6
|
@@ -17,9 +17,11 @@
|
|
|
17
17
|
flex-direction: row-reverse;
|
|
18
18
|
justify-content: flex-end;
|
|
19
19
|
}
|
|
20
|
-
.
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
.creatives-templates-container {
|
|
21
|
+
.ant-tabs-tabpane{
|
|
22
|
+
padding: 16px 16px 16px 0;
|
|
23
|
+
border: solid 1px #D6D6D6;
|
|
24
|
+
}
|
|
23
25
|
}
|
|
24
26
|
.ant-radio-wrapper{
|
|
25
27
|
font-size: 14px;
|
|
@@ -17,9 +17,11 @@
|
|
|
17
17
|
flex-direction: row-reverse;
|
|
18
18
|
justify-content: flex-end;
|
|
19
19
|
}
|
|
20
|
-
.
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
.creatives-templates-container {
|
|
21
|
+
.ant-tabs-tabpane{
|
|
22
|
+
padding: 16px 16px 16px 0;
|
|
23
|
+
border: solid 1px #D6D6D6;
|
|
24
|
+
}
|
|
23
25
|
}
|
|
24
26
|
.ant-radio-wrapper{
|
|
25
27
|
font-size: 14px;
|
|
@@ -16,11 +16,14 @@
|
|
|
16
16
|
flex-direction: row-reverse;
|
|
17
17
|
justify-content: flex-end;
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
|
|
20
|
+
.creatives-templates-container {
|
|
21
|
+
.ant-tabs-tabpane{
|
|
22
|
+
border: solid 1px #d9d9d9;
|
|
23
|
+
border-top: none;
|
|
24
|
+
margin-top: -0.2%;
|
|
25
|
+
min-height: calc(70vh);
|
|
26
|
+
}
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
.ant-tabs-extra-content{
|
package/package.json
CHANGED
package/v2Components/mockdata.js
CHANGED
|
@@ -69,8 +69,8 @@ export default {
|
|
|
69
69
|
status: 'approved',
|
|
70
70
|
templateId: 'HTee0274fb8dfdd45427bb678f875b0d54',
|
|
71
71
|
hostName: 'twiliowhatsapptrans',
|
|
72
|
-
accessToken: '
|
|
73
|
-
accountId: '
|
|
72
|
+
accessToken: 'asdf', //false positive
|
|
73
|
+
accountId: 'asdf', //false positive
|
|
74
74
|
templateEditor: false,
|
|
75
75
|
mediaType: 'TEXT',
|
|
76
76
|
languages: [
|
|
@@ -250,7 +250,7 @@ export const Whatsapp = (props) => {
|
|
|
250
250
|
margin-left: -32px;
|
|
251
251
|
padding: ${CAP_SPACE_32} ${CAP_SPACE_24};
|
|
252
252
|
z-index: 1;
|
|
253
|
-
|
|
253
|
+
|
|
254
254
|
.ant-btn {
|
|
255
255
|
margin-right: ${CAP_SPACE_16};
|
|
256
256
|
}
|
|
@@ -602,7 +602,7 @@ export const Whatsapp = (props) => {
|
|
|
602
602
|
// } else {
|
|
603
603
|
// setPreviewUrl('');
|
|
604
604
|
// }
|
|
605
|
-
// }
|
|
605
|
+
// }
|
|
606
606
|
// }, [updatedSmsEditor])
|
|
607
607
|
|
|
608
608
|
// const debounceFn = useCallback(
|
|
@@ -697,7 +697,7 @@ export const Whatsapp = (props) => {
|
|
|
697
697
|
}
|
|
698
698
|
handleCarouselValueChange(carouselIndex, [...tagFields, {fieldName: "varMap", value: carouselVarMap}, {fieldName: "updatedBodyText", value: arr}])
|
|
699
699
|
break;
|
|
700
|
-
default:
|
|
700
|
+
default:
|
|
701
701
|
varMap[areaId] = messageData;
|
|
702
702
|
setUpdatedSmsEditor(arr);
|
|
703
703
|
}
|
|
@@ -845,7 +845,7 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
845
845
|
return overallLength;
|
|
846
846
|
}
|
|
847
847
|
};
|
|
848
|
-
|
|
848
|
+
|
|
849
849
|
//used by create and edit
|
|
850
850
|
const renderMessageLength = (type, currentLength, carousel) => (
|
|
851
851
|
<CapHeading type="label1" className="whatsapp-render-message-length">
|
|
@@ -1306,7 +1306,7 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
1306
1306
|
} else {
|
|
1307
1307
|
errorMessage = variableErrorHandling(value, MESSAGE_TEXT);
|
|
1308
1308
|
}
|
|
1309
|
-
//we are not allowing user input incase of authentication flow
|
|
1309
|
+
//we are not allowing user input incase of authentication flow
|
|
1310
1310
|
if(isAuthenticationTemplate){
|
|
1311
1311
|
errorMessage = false;
|
|
1312
1312
|
}
|
|
@@ -1596,7 +1596,7 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
1596
1596
|
});
|
|
1597
1597
|
};
|
|
1598
1598
|
const isMediatypeValid =()=> ((isMediaTypeImage && whatsappImageSrc === "") || (isMediaTypeVideo && whatsappVideoSrcAndPreview?.whatsappVideoSrc === "") || (isMediaTypeDoc && whatsappDocSource === ""));
|
|
1599
|
-
|
|
1599
|
+
|
|
1600
1600
|
const isDisableDone = () => {
|
|
1601
1601
|
//if template name is not entered
|
|
1602
1602
|
if (templateName.trim() === '' || templateNameError) {
|
|
@@ -1615,7 +1615,7 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
1615
1615
|
return true;
|
|
1616
1616
|
}
|
|
1617
1617
|
//if media type is image, video or document and the mediaType file is not uploaded
|
|
1618
|
-
|
|
1618
|
+
|
|
1619
1619
|
if (!isMediaTypeText && isMediatypeValid() ) {
|
|
1620
1620
|
return true;
|
|
1621
1621
|
}
|
|
@@ -1643,16 +1643,16 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
1643
1643
|
return true;
|
|
1644
1644
|
}
|
|
1645
1645
|
if (isBtnTypeQuickReply) {
|
|
1646
|
-
// Disable button if there are no quick reply buttons or if any button is not saved
|
|
1646
|
+
// Disable button if there are no quick reply buttons or if any button is not saved
|
|
1647
1647
|
return !quickReplyData?.length || !quickReplyData.every(qr => qr?.isSaved);
|
|
1648
1648
|
}
|
|
1649
1649
|
if (isMediaTypeCarousel) {
|
|
1650
1650
|
const carouselDisableCheck = carouselData.some((data) => {
|
|
1651
1651
|
return (
|
|
1652
|
-
data?.bodyError ||
|
|
1653
|
-
data?.bodyText === "" ||
|
|
1654
|
-
(carouselMediaType === IMAGE.toLowerCase() && !data?.imageSrc) ||
|
|
1655
|
-
(carouselMediaType === VIDEO.toLowerCase() && !data?.videoSrc) ||
|
|
1652
|
+
data?.bodyError ||
|
|
1653
|
+
data?.bodyText === "" ||
|
|
1654
|
+
(carouselMediaType === IMAGE.toLowerCase() && !data?.imageSrc) ||
|
|
1655
|
+
(carouselMediaType === VIDEO.toLowerCase() && !data?.videoSrc) ||
|
|
1656
1656
|
!data?.buttons.every((button) => button?.isSaved === true)
|
|
1657
1657
|
);
|
|
1658
1658
|
});
|
|
@@ -1672,7 +1672,7 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
1672
1672
|
|
|
1673
1673
|
const handleCarouselMediaOptions = ({ target: { value = ''} = {} }) => {
|
|
1674
1674
|
setCarouselData(CAROUSEL_INITIAL_DATA);
|
|
1675
|
-
setCarouselMediaType(value);
|
|
1675
|
+
setCarouselMediaType(value);
|
|
1676
1676
|
}
|
|
1677
1677
|
|
|
1678
1678
|
const onTabChange = (index) => {
|
|
@@ -1874,7 +1874,7 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
1874
1874
|
const addContent = () => {
|
|
1875
1875
|
const updatedCarouselData = cloneDeep(carouselData); // Shallow copy, assuming carouselData isn't deeply nested
|
|
1876
1876
|
const firstCarouselButtonData = updatedCarouselData[0]?.buttons;
|
|
1877
|
-
|
|
1877
|
+
|
|
1878
1878
|
const buttonArray = firstCarouselButtonData.map((button) => {
|
|
1879
1879
|
switch (button?.buttonType) {
|
|
1880
1880
|
case PHONE_NUMBER:
|
|
@@ -1889,7 +1889,7 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
1889
1889
|
newCard.buttons = buttonArray;
|
|
1890
1890
|
setCarouselData([...updatedCarouselData, newCard]);
|
|
1891
1891
|
};
|
|
1892
|
-
|
|
1892
|
+
|
|
1893
1893
|
const checkDisableAddCarouselButton = () => {
|
|
1894
1894
|
return carouselData?.[0]?.buttons.some((button) => button?.isSaved === true);
|
|
1895
1895
|
}
|
|
@@ -1954,7 +1954,7 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
1954
1954
|
options={getCategoryOptions(host)}
|
|
1955
1955
|
onChange={onTemplateCategoryChange}
|
|
1956
1956
|
value={templateCategory}
|
|
1957
|
-
/>
|
|
1957
|
+
/>
|
|
1958
1958
|
</CapColumn>
|
|
1959
1959
|
{/* template media type */}
|
|
1960
1960
|
<CapColumn span={12}>
|
|
@@ -2352,6 +2352,8 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
2352
2352
|
// on change event of Text Area
|
|
2353
2353
|
const textAreaValueChange = ({ target: { value, id } }, type, carousel) => {
|
|
2354
2354
|
const numId = Number(id.slice(id.indexOf("_") + 1));
|
|
2355
|
+
// Validation: Prevent empty or only-space values
|
|
2356
|
+
const isInvalidValue = value?.trim() === "";
|
|
2355
2357
|
//assign entered value to varMap
|
|
2356
2358
|
if (type === HEADER_TEXT) {
|
|
2357
2359
|
const arr = [...updatedHeaderData];
|
|
@@ -2359,17 +2361,20 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
2359
2361
|
...prevState,
|
|
2360
2362
|
[id]: value,
|
|
2361
2363
|
}));
|
|
2362
|
-
if (
|
|
2364
|
+
if (isInvalidValue) {
|
|
2363
2365
|
arr[numId] = id.slice(0, id.indexOf("_"));
|
|
2366
|
+
setTemplateHeaderError(formatMessage(messages.emptyVariableValueErrorMessage));
|
|
2364
2367
|
} else {
|
|
2365
2368
|
arr[numId] = value;
|
|
2369
|
+
setTemplateHeaderError(false);
|
|
2366
2370
|
}
|
|
2367
2371
|
setUpdatedHeaderData(arr);
|
|
2368
2372
|
} else if (type === CAROUSEL_TEXT) {
|
|
2369
2373
|
const carouselUpdatedBodyTextData = carousel?.data?.updatedBodyText || [];
|
|
2370
2374
|
const arr = [...carouselUpdatedBodyTextData];
|
|
2371
|
-
if (
|
|
2375
|
+
if (isInvalidValue) {
|
|
2372
2376
|
arr[numId] = id.slice(0, id.indexOf("_"));
|
|
2377
|
+
// (You may want to add a state for carousel variable errors if not present)
|
|
2373
2378
|
} else {
|
|
2374
2379
|
arr[numId] = value;
|
|
2375
2380
|
}
|
|
@@ -2380,14 +2385,18 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
2380
2385
|
tagFields = tagValidation(arr, carouselBodyVarRegex, CAROUSEL_TEXT) || [];
|
|
2381
2386
|
}
|
|
2382
2387
|
handleCarouselValueChange(carousel?.carouselIndex, [...tagFields, {fieldName: "varMap", value: bodyVarMapData}, {fieldName: 'updatedBodyText', value: arr}])
|
|
2388
|
+
// Set error for carousel variable if needed
|
|
2389
|
+
// (You may want to add a state for carousel variable errors if not present)
|
|
2383
2390
|
} else {
|
|
2384
2391
|
const arr = [...updatedSmsEditor];
|
|
2385
2392
|
varMap[id] = value;
|
|
2386
2393
|
//based on entered value update updatedSmsEditor
|
|
2387
|
-
if (
|
|
2394
|
+
if (isInvalidValue) {
|
|
2388
2395
|
arr[numId] = id.slice(0, id.indexOf("_"));
|
|
2396
|
+
setTemplateMessageError(formatMessage(messages.emptyVariableValueErrorMessage));
|
|
2389
2397
|
} else {
|
|
2390
2398
|
arr[numId] = value;
|
|
2399
|
+
setTemplateMessageError(false);
|
|
2391
2400
|
}
|
|
2392
2401
|
setUpdatedSmsEditor(arr);
|
|
2393
2402
|
}
|
|
@@ -2796,10 +2805,10 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
2796
2805
|
if (isMediaTypeCarousel) {
|
|
2797
2806
|
carouselDisableCheck = carouselData.some((data) => {
|
|
2798
2807
|
return (
|
|
2799
|
-
data.carouselTagValidationErr ||
|
|
2800
|
-
Object.values(data.varMap).some((inputValue) => inputValue === "") ||
|
|
2808
|
+
data.carouselTagValidationErr ||
|
|
2809
|
+
Object.values(data.varMap).some((inputValue) => inputValue === "") ||
|
|
2801
2810
|
computeTextLength(CAROUSEL_TEXT, data) > TEMPLATE_MESSAGE_MAX_LENGTH ||
|
|
2802
|
-
(carouselMediaType === IMAGE.toLowerCase() && !data.imageSrc) ||
|
|
2811
|
+
(carouselMediaType === IMAGE.toLowerCase() && !data.imageSrc) ||
|
|
2803
2812
|
(carouselMediaType === VIDEO.toLowerCase() && !data.videoSrc) ||
|
|
2804
2813
|
data?.buttons.some((btn) => btn?.url?.includes("{{1}}"))
|
|
2805
2814
|
);
|
|
@@ -265,8 +265,7 @@ export default defineMessages({
|
|
|
265
265
|
},
|
|
266
266
|
tagContentMismatchError: {
|
|
267
267
|
id: `${prefix}.tagContentMismatchError`,
|
|
268
|
-
defaultMessage:
|
|
269
|
-
'TAG CONTENT MISMATCH: The language and/or template category selected don’t match the template content.',
|
|
268
|
+
defaultMessage: "TAG CONTENT MISMATCH: The language and/or template category selected do not match the template content.",
|
|
270
269
|
},
|
|
271
270
|
invalidFormatError: {
|
|
272
271
|
id: `${prefix}.invalidFormatError`,
|
|
@@ -697,37 +696,37 @@ export default defineMessages({
|
|
|
697
696
|
id: `${prefix}.checkExpiryCode`,
|
|
698
697
|
defaultMessage: 'OTP settings',
|
|
699
698
|
},
|
|
700
|
-
expiryCodeNote:{
|
|
699
|
+
expiryCodeNote: {
|
|
701
700
|
id: `${prefix}.expiryCodeNote`,
|
|
702
701
|
defaultMessage: 'We suggest using the same expiry time as specified in the OTP settings.',
|
|
703
702
|
},
|
|
704
|
-
codeExpiresIn:{
|
|
703
|
+
codeExpiresIn: {
|
|
705
704
|
id: `${prefix}.codeExpiresIn`,
|
|
706
705
|
defaultMessage: 'This code expires in',
|
|
707
706
|
},
|
|
708
|
-
minutes:{
|
|
707
|
+
minutes: {
|
|
709
708
|
id: `${prefix}.minutes`,
|
|
710
709
|
defaultMessage: 'minutes',
|
|
711
710
|
},
|
|
712
|
-
codeExpiryNumMinutes:{
|
|
711
|
+
codeExpiryNumMinutes: {
|
|
713
712
|
id: `${prefix}.codeExpiryNumMinutes`,
|
|
714
713
|
defaultMessage: 'This code expires in <num_minutes> minutes.',
|
|
715
714
|
},
|
|
716
|
-
authenticationMsg:{
|
|
715
|
+
authenticationMsg: {
|
|
717
716
|
id: `${prefix}.authenticationMsg`,
|
|
718
717
|
defaultMessage: "{{verification_code}} is your verification code.",
|
|
719
718
|
},
|
|
720
|
-
securitySuffix:{
|
|
719
|
+
securitySuffix: {
|
|
721
720
|
id: `${prefix}.securitySuffix`,
|
|
722
721
|
defaultMessage: 'For your security, do not share this code.',
|
|
723
722
|
},
|
|
724
|
-
numMinutes:{
|
|
723
|
+
numMinutes: {
|
|
725
724
|
id: `${prefix}.numMinutes`,
|
|
726
725
|
defaultMessage: '<num_minutes>',
|
|
727
726
|
},
|
|
728
|
-
enterExpiryTime:{
|
|
727
|
+
enterExpiryTime: {
|
|
729
728
|
id: `${prefix}.enterExpiryTime`,
|
|
730
|
-
defaultMessage: "Enter expiry time"
|
|
729
|
+
defaultMessage: "Enter expiry time",
|
|
731
730
|
},
|
|
732
731
|
checkExpiryTooltipHeader: {
|
|
733
732
|
id: `${prefix}.checkExpiryTooltipHeader`,
|
|
@@ -773,4 +772,8 @@ export default defineMessages({
|
|
|
773
772
|
id: `${prefix}.paused`,
|
|
774
773
|
defaultMessage: 'Paused',
|
|
775
774
|
},
|
|
775
|
+
emptyVariableValueErrorMessage: {
|
|
776
|
+
id: `${prefix}.emptyVariableValueErrorMessage`,
|
|
777
|
+
defaultMessage: 'Variable value cannot be empty or only spaces.',
|
|
778
|
+
},
|
|
776
779
|
});
|
|
@@ -227089,7 +227089,7 @@ new message content.",
|
|
|
227089
227089
|
],
|
|
227090
227090
|
Array [
|
|
227091
227091
|
Object {
|
|
227092
|
-
"defaultMessage": "TAG CONTENT MISMATCH: The language and/or template category selected
|
|
227092
|
+
"defaultMessage": "TAG CONTENT MISMATCH: The language and/or template category selected do not match the template content.",
|
|
227093
227093
|
"id": "creatives.containersV2.Whatsapp.tagContentMismatchError",
|
|
227094
227094
|
},
|
|
227095
227095
|
],
|
|
@@ -227201,7 +227201,7 @@ new message content.",
|
|
|
227201
227201
|
],
|
|
227202
227202
|
Array [
|
|
227203
227203
|
Object {
|
|
227204
|
-
"defaultMessage": "TAG CONTENT MISMATCH: The language and/or template category selected
|
|
227204
|
+
"defaultMessage": "TAG CONTENT MISMATCH: The language and/or template category selected do not match the template content.",
|
|
227205
227205
|
"id": "creatives.containersV2.Whatsapp.tagContentMismatchError",
|
|
227206
227206
|
},
|
|
227207
227207
|
],
|
|
@@ -235685,7 +235685,7 @@ Click {{3}} to unsubscribe'",
|
|
|
235685
235685
|
],
|
|
235686
235686
|
Array [
|
|
235687
235687
|
Object {
|
|
235688
|
-
"defaultMessage": "TAG CONTENT MISMATCH: The language and/or template category selected
|
|
235688
|
+
"defaultMessage": "TAG CONTENT MISMATCH: The language and/or template category selected do not match the template content.",
|
|
235689
235689
|
"id": "creatives.containersV2.Whatsapp.tagContentMismatchError",
|
|
235690
235690
|
},
|
|
235691
235691
|
],
|
|
@@ -235797,7 +235797,7 @@ Click {{3}} to unsubscribe'",
|
|
|
235797
235797
|
],
|
|
235798
235798
|
Array [
|
|
235799
235799
|
Object {
|
|
235800
|
-
"defaultMessage": "TAG CONTENT MISMATCH: The language and/or template category selected
|
|
235800
|
+
"defaultMessage": "TAG CONTENT MISMATCH: The language and/or template category selected do not match the template content.",
|
|
235801
235801
|
"id": "creatives.containersV2.Whatsapp.tagContentMismatchError",
|
|
235802
235802
|
},
|
|
235803
235803
|
],
|
|
@@ -248917,7 +248917,7 @@ new message content.",
|
|
|
248917
248917
|
],
|
|
248918
248918
|
Array [
|
|
248919
248919
|
Object {
|
|
248920
|
-
"defaultMessage": "TAG CONTENT MISMATCH: The language and/or template category selected
|
|
248920
|
+
"defaultMessage": "TAG CONTENT MISMATCH: The language and/or template category selected do not match the template content.",
|
|
248921
248921
|
"id": "creatives.containersV2.Whatsapp.tagContentMismatchError",
|
|
248922
248922
|
},
|
|
248923
248923
|
],
|
|
@@ -249029,7 +249029,7 @@ new message content.",
|
|
|
249029
249029
|
],
|
|
249030
249030
|
Array [
|
|
249031
249031
|
Object {
|
|
249032
|
-
"defaultMessage": "TAG CONTENT MISMATCH: The language and/or template category selected
|
|
249032
|
+
"defaultMessage": "TAG CONTENT MISMATCH: The language and/or template category selected do not match the template content.",
|
|
249033
249033
|
"id": "creatives.containersV2.Whatsapp.tagContentMismatchError",
|
|
249034
249034
|
},
|
|
249035
249035
|
],
|