@capillarytech/creatives-library 8.0.316-alpha.3 → 8.0.316-alpha.4
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/templateVarUtils.test.js +160 -0
- package/v2Components/CapTagList/index.js +10 -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 +172 -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 +245 -0
- package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +25 -4
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +100 -1
- package/v2Components/CommonTestAndPreview/tests/index.test.js +19 -1
- package/v2Components/CommonTestAndPreview/tests/previewApiUtils.test.js +67 -0
- package/v2Components/CommonTestAndPreview/tests/sagas.test.js +2 -2
- package/v2Components/FormBuilder/index.js +7 -1
- 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 +327 -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/CreativesContainer/CreativesSlideBoxWrapper.js +43 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +36 -4
- 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 +286 -93
- package/v2Containers/CreativesContainer/index.scss +51 -1
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.localTemplates.test.js +90 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +8 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +20 -10
- package/v2Containers/CreativesContainer/tests/index.test.js +71 -9
- package/v2Containers/CreativesContainer/tests/useLocalTemplatesProp.test.js +125 -0
- package/v2Containers/Rcs/constants.js +32 -1
- package/v2Containers/Rcs/index.js +950 -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 +81 -36
- package/v2Containers/Sms/smsFormDataHelpers.js +67 -0
- package/v2Containers/SmsTrai/Create/index.js +9 -4
- package/v2Containers/SmsTrai/Edit/constants.js +2 -0
- package/v2Containers/SmsTrai/Edit/index.js +609 -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 +37 -8
- package/v2Containers/TagList/index.js +6 -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 +110 -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/WebPush/Create/components/MessageSection.js +54 -18
- package/v2Containers/WebPush/Create/components/MessageSection.test.js +28 -0
- package/v2Containers/WebPush/Create/components/__snapshots__/MessageSection.test.js.snap +7 -3
- package/v2Containers/Whatsapp/index.js +7 -23
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +578 -34
- package/v2Containers/Whatsapp/tests/index.test.js +172 -0
|
@@ -1354,3 +1354,175 @@ describe('Haptic carousel file handle mapping', () => {
|
|
|
1354
1354
|
expect(cd[0].karixFileHandle).toBe('');
|
|
1355
1355
|
});
|
|
1356
1356
|
});
|
|
1357
|
+
|
|
1358
|
+
describe('WhatsApp edit Done button whitespace validation', () => {
|
|
1359
|
+
let renderedComponent;
|
|
1360
|
+
|
|
1361
|
+
const createWhatsappTemplate = jest.fn();
|
|
1362
|
+
const getFormData = jest.fn();
|
|
1363
|
+
const clearCreateResponse = jest.fn();
|
|
1364
|
+
const getTemplateDetails = jest.fn();
|
|
1365
|
+
const resetEditTemplate = jest.fn();
|
|
1366
|
+
const fetchSchemaForEntity = jest.fn();
|
|
1367
|
+
const handleClose = jest.fn();
|
|
1368
|
+
const onCreateComplete = jest.fn();
|
|
1369
|
+
const formatMessage = jest.fn();
|
|
1370
|
+
const getMetaTags = jest.fn();
|
|
1371
|
+
const resetMetaTags = jest.fn();
|
|
1372
|
+
|
|
1373
|
+
const mountEditFlow = (editData, accountData = mockData.accountData1) => {
|
|
1374
|
+
renderedComponent = mountWithIntl(
|
|
1375
|
+
<Provider store={store}>
|
|
1376
|
+
<Whatsapp
|
|
1377
|
+
actions={{
|
|
1378
|
+
createWhatsappTemplate,
|
|
1379
|
+
clearCreateResponse,
|
|
1380
|
+
getTemplateDetails,
|
|
1381
|
+
resetEditTemplate,
|
|
1382
|
+
getMetaTags,
|
|
1383
|
+
resetMetaTags,
|
|
1384
|
+
}}
|
|
1385
|
+
globalActions={{ fetchSchemaForEntity }}
|
|
1386
|
+
onCreateComplete={onCreateComplete}
|
|
1387
|
+
handleClose={handleClose}
|
|
1388
|
+
getFormData={getFormData}
|
|
1389
|
+
params={{ id: editData?.templateDetails?._id || 'edit-whitespace-id' }}
|
|
1390
|
+
editData={editData}
|
|
1391
|
+
accountData={accountData}
|
|
1392
|
+
location={mockData.location}
|
|
1393
|
+
intl={{ formatMessage }}
|
|
1394
|
+
isFullMode={false}
|
|
1395
|
+
isEditFlow
|
|
1396
|
+
loadingTags={false}
|
|
1397
|
+
metaEntities={[]}
|
|
1398
|
+
getDefaultTags
|
|
1399
|
+
Templates={{
|
|
1400
|
+
senderDetails: {
|
|
1401
|
+
status: 'SUCCESS',
|
|
1402
|
+
domainProperties: [
|
|
1403
|
+
{
|
|
1404
|
+
domainProperties: {
|
|
1405
|
+
connectionProperties: {
|
|
1406
|
+
sourceAccountIdentifier: '2000222347',
|
|
1407
|
+
baseUrl: 'https://api.gupshup.io/whatsapp/v1',
|
|
1408
|
+
},
|
|
1409
|
+
},
|
|
1410
|
+
},
|
|
1411
|
+
],
|
|
1412
|
+
},
|
|
1413
|
+
}}
|
|
1414
|
+
/>
|
|
1415
|
+
</Provider>,
|
|
1416
|
+
);
|
|
1417
|
+
};
|
|
1418
|
+
|
|
1419
|
+
const getDoneButton = () => renderedComponent.find('CapButton.whatsapp-create-btn').at(0);
|
|
1420
|
+
|
|
1421
|
+
const getFirstVariableTextarea = () => renderedComponent
|
|
1422
|
+
.find('textarea.TextArea__StyledTextArea-sc-177dfyt-2')
|
|
1423
|
+
.at(0);
|
|
1424
|
+
|
|
1425
|
+
it('keeps Done disabled for whitespace-only message variable', () => {
|
|
1426
|
+
const editData = {
|
|
1427
|
+
templateDetails: {
|
|
1428
|
+
_id: 'edit-msg-whitespace',
|
|
1429
|
+
name: 'msg_whitespace',
|
|
1430
|
+
type: 'WHATSAPP',
|
|
1431
|
+
versions: {
|
|
1432
|
+
base: {
|
|
1433
|
+
content: {
|
|
1434
|
+
whatsapp: {
|
|
1435
|
+
status: 'approved',
|
|
1436
|
+
category: 'ALERT_UPDATE',
|
|
1437
|
+
mediaType: 'TEXT',
|
|
1438
|
+
buttonType: 'NONE',
|
|
1439
|
+
varMapped: {},
|
|
1440
|
+
languages: [{ language: 'en', content: 'Your code is {{1}}' }],
|
|
1441
|
+
},
|
|
1442
|
+
},
|
|
1443
|
+
},
|
|
1444
|
+
},
|
|
1445
|
+
},
|
|
1446
|
+
};
|
|
1447
|
+
|
|
1448
|
+
mountEditFlow(editData);
|
|
1449
|
+
getFirstVariableTextarea().simulate('change', { target: { value: ' ', id: '{{1}}_3' } });
|
|
1450
|
+
renderedComponent.update();
|
|
1451
|
+
|
|
1452
|
+
expect(getDoneButton().props().disabled).toBe(true);
|
|
1453
|
+
});
|
|
1454
|
+
|
|
1455
|
+
it('keeps Done disabled for whitespace-only header variable', () => {
|
|
1456
|
+
const editData = {
|
|
1457
|
+
templateDetails: {
|
|
1458
|
+
_id: 'edit-header-whitespace',
|
|
1459
|
+
name: 'header_whitespace',
|
|
1460
|
+
type: 'WHATSAPP',
|
|
1461
|
+
versions: {
|
|
1462
|
+
base: {
|
|
1463
|
+
content: {
|
|
1464
|
+
whatsapp: {
|
|
1465
|
+
status: 'approved',
|
|
1466
|
+
category: 'ALERT_UPDATE',
|
|
1467
|
+
mediaType: 'TEXT',
|
|
1468
|
+
buttonType: 'NONE',
|
|
1469
|
+
varMapped: {},
|
|
1470
|
+
whatsappMedia: {
|
|
1471
|
+
header: 'Hi {{1}}',
|
|
1472
|
+
footer: '',
|
|
1473
|
+
headerVarMapped: {},
|
|
1474
|
+
},
|
|
1475
|
+
languages: [{ language: 'en', content: 'Simple message without vars' }],
|
|
1476
|
+
},
|
|
1477
|
+
},
|
|
1478
|
+
},
|
|
1479
|
+
},
|
|
1480
|
+
},
|
|
1481
|
+
};
|
|
1482
|
+
|
|
1483
|
+
mountEditFlow(editData);
|
|
1484
|
+
getFirstVariableTextarea().simulate('change', { target: { value: ' ', id: '{{1}}_1' } });
|
|
1485
|
+
renderedComponent.update();
|
|
1486
|
+
|
|
1487
|
+
expect(getDoneButton().props().disabled).toBe(true);
|
|
1488
|
+
});
|
|
1489
|
+
|
|
1490
|
+
it('keeps Done disabled for whitespace-only carousel variable', () => {
|
|
1491
|
+
const editData = {
|
|
1492
|
+
templateDetails: {
|
|
1493
|
+
_id: 'edit-carousel-whitespace',
|
|
1494
|
+
name: 'carousel_whitespace',
|
|
1495
|
+
type: 'WHATSAPP',
|
|
1496
|
+
versions: {
|
|
1497
|
+
base: {
|
|
1498
|
+
content: {
|
|
1499
|
+
whatsapp: {
|
|
1500
|
+
status: 'approved',
|
|
1501
|
+
category: 'MARKETING',
|
|
1502
|
+
mediaType: 'CAROUSEL',
|
|
1503
|
+
buttonType: 'NONE',
|
|
1504
|
+
varMapped: {},
|
|
1505
|
+
languages: [{ language: 'en', content: 'Main message' }],
|
|
1506
|
+
carouselData: [
|
|
1507
|
+
{
|
|
1508
|
+
mediaType: 'image',
|
|
1509
|
+
imageUrl: 'https://cdn.example.com/card.jpg',
|
|
1510
|
+
bodyText: 'Card body {{1}}',
|
|
1511
|
+
varMap: {},
|
|
1512
|
+
buttons: [],
|
|
1513
|
+
},
|
|
1514
|
+
],
|
|
1515
|
+
},
|
|
1516
|
+
},
|
|
1517
|
+
},
|
|
1518
|
+
},
|
|
1519
|
+
},
|
|
1520
|
+
};
|
|
1521
|
+
|
|
1522
|
+
mountEditFlow(editData, mockData.accountData2);
|
|
1523
|
+
getFirstVariableTextarea().simulate('change', { target: { value: ' ', id: '{{1}}_2' } });
|
|
1524
|
+
renderedComponent.update();
|
|
1525
|
+
|
|
1526
|
+
expect(getDoneButton().props().disabled).toBe(true);
|
|
1527
|
+
});
|
|
1528
|
+
});
|