@capillarytech/creatives-library 9.0.15-alpha.1 → 9.0.16
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 +0 -29
- package/global-styles.js +1 -1
- package/package.json +1 -1
- package/services/tests/api.test.js +20 -35
- package/utils/commonUtils.js +1 -19
- package/v2Components/CapActionButton/constants.js +0 -7
- package/v2Components/CapActionButton/index.js +109 -168
- package/v2Components/CapActionButton/index.scss +5 -156
- package/v2Components/CapActionButton/messages.js +3 -19
- package/v2Components/CapActionButton/tests/index.test.js +18 -42
- package/v2Components/CapImageUpload/index.js +2 -2
- package/v2Components/CapTagList/index.js +0 -10
- package/v2Components/CommonTestAndPreview/CustomValuesEditor.js +48 -70
- package/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +2 -8
- package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +21 -214
- package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +0 -16
- package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +9 -83
- package/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +0 -30
- package/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +11 -60
- package/v2Components/CommonTestAndPreview/SendTestMessage.js +5 -10
- package/v2Components/CommonTestAndPreview/UnifiedPreview/RcsPreviewContent.js +23 -201
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +76 -355
- package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +8 -155
- package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +0 -11
- package/v2Components/CommonTestAndPreview/constants.js +2 -38
- package/v2Components/CommonTestAndPreview/index.js +222 -761
- package/v2Components/CommonTestAndPreview/messages.js +3 -45
- package/v2Components/CommonTestAndPreview/sagas.js +6 -25
- package/v2Components/CommonTestAndPreview/tests/CommonTestAndPreview.addTestCustomer.test.js +0 -1
- package/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +267 -284
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +65 -231
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +5 -118
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +0 -341
- package/v2Components/CommonTestAndPreview/tests/PreviewSection.test.js +1 -8
- package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +13 -34
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/RcsPreviewContent.test.js +283 -281
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +1 -199
- package/v2Components/CommonTestAndPreview/tests/index.test.js +4 -133
- package/v2Components/CommonTestAndPreview/tests/sagas.test.js +24 -31
- package/v2Components/TemplatePreview/_templatePreview.scss +22 -41
- package/v2Components/TemplatePreview/index.js +31 -143
- package/v2Components/TemplatePreview/tests/index.test.js +0 -142
- package/v2Components/TestAndPreviewSlidebox/CustomValuesEditor.js +6 -6
- package/v2Components/TestAndPreviewSlidebox/index.js +1 -13
- package/v2Components/TestAndPreviewSlidebox/sagas.js +4 -11
- package/v2Components/TestAndPreviewSlidebox/tests/saga.test.js +1 -3
- package/v2Containers/CommunicationFlow/Tests/CommunicationFlow.test.js +1 -4
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/DeliverySettingsSection.test.js +0 -4
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/SenderDetails.test.js +20 -20
- package/v2Containers/CreativesContainer/SlideBoxContent.js +7 -36
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +5 -14
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +5 -36
- package/v2Containers/CreativesContainer/constants.js +0 -11
- package/v2Containers/CreativesContainer/index.js +104 -323
- package/v2Containers/CreativesContainer/index.scss +1 -83
- package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +34 -79
- package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +16 -79
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +0 -8
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +90 -333
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +15 -20
- package/v2Containers/CreativesContainer/tests/index.test.js +9 -71
- package/v2Containers/Email/index.js +5 -2
- package/v2Containers/MobilePush/Create/test/saga.test.js +2 -2
- package/v2Containers/Rcs/constants.js +11 -131
- package/v2Containers/Rcs/index.js +810 -2605
- package/v2Containers/Rcs/index.scss +8 -289
- package/v2Containers/Rcs/messages.js +3 -34
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +38537 -73535
- package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap +8 -0
- package/v2Containers/Rcs/tests/index.test.js +36 -147
- package/v2Containers/Rcs/tests/mockData.js +0 -38
- package/v2Containers/Rcs/tests/utils.test.js +30 -646
- package/v2Containers/Rcs/utils.js +11 -478
- package/v2Containers/Sms/Create/index.js +48 -115
- package/v2Containers/SmsTrai/Create/index.js +4 -9
- package/v2Containers/SmsTrai/Edit/constants.js +0 -2
- package/v2Containers/SmsTrai/Edit/index.js +169 -678
- package/v2Containers/SmsTrai/Edit/messages.js +4 -14
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +2854 -5455
- package/v2Containers/SmsWrapper/index.js +8 -37
- package/v2Containers/TagList/index.js +0 -6
- package/v2Containers/Templates/_templates.scss +12 -171
- package/v2Containers/Templates/actions.js +0 -11
- package/v2Containers/Templates/constants.js +0 -2
- package/v2Containers/Templates/index.js +55 -125
- package/v2Containers/Templates/sagas.js +13 -57
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1015 -1060
- package/v2Containers/Templates/tests/sagas.test.js +16 -199
- package/v2Containers/TemplatesV2/TemplatesV2.style.js +1 -72
- package/v2Containers/TemplatesV2/index.js +23 -86
- package/v2Containers/WeChat/MapTemplates/test/saga.test.js +9 -9
- package/v2Containers/Whatsapp/index.js +20 -3
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +34 -578
- package/utils/rcsPayloadUtils.js +0 -92
- package/utils/templateVarUtils.js +0 -201
- package/utils/tests/rcsPayloadUtils.test.js +0 -226
- package/utils/tests/templateVarUtils.test.js +0 -204
- package/v2Components/CommonTestAndPreview/previewApiUtils.js +0 -59
- package/v2Components/CommonTestAndPreview/tests/previewApiUtils.test.js +0 -67
- package/v2Components/CommonTestAndPreview/utils.js +0 -84
- package/v2Components/SmsFallback/SmsFallbackLocalSelector.js +0 -91
- package/v2Components/SmsFallback/constants.js +0 -94
- package/v2Components/SmsFallback/index.js +0 -958
- package/v2Components/SmsFallback/index.scss +0 -266
- package/v2Components/SmsFallback/messages.js +0 -78
- package/v2Components/SmsFallback/smsFallbackUtils.js +0 -120
- package/v2Components/SmsFallback/tests/SmsFallbackLocalSelector.test.js +0 -50
- package/v2Components/SmsFallback/tests/rcsSmsFallback.acceptance.test.js +0 -147
- package/v2Components/SmsFallback/tests/smsFallbackHandlers.test.js +0 -304
- package/v2Components/SmsFallback/tests/smsFallbackUi.test.js +0 -208
- package/v2Components/SmsFallback/tests/smsFallbackUtils.test.js +0 -309
- package/v2Components/SmsFallback/tests/useLocalTemplateList.test.js +0 -422
- package/v2Components/SmsFallback/useLocalTemplateList.js +0 -92
- package/v2Components/TemplatePreview/constants.js +0 -2
- package/v2Components/VarSegmentMessageEditor/constants.js +0 -2
- package/v2Components/VarSegmentMessageEditor/index.js +0 -125
- package/v2Components/VarSegmentMessageEditor/index.scss +0 -46
- package/v2Containers/CreativesContainer/CreativesSlideBoxWrapper.js +0 -17
- package/v2Containers/CreativesContainer/embeddedSlideboxUtils.js +0 -79
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.localTemplates.test.js +0 -90
- package/v2Containers/CreativesContainer/tests/embeddedSlideboxUtils.test.js +0 -258
- package/v2Containers/CreativesContainer/tests/useLocalTemplatesProp.test.js +0 -125
- package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +0 -227
- package/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +0 -318
- package/v2Containers/Sms/smsFormDataHelpers.js +0 -67
- package/v2Containers/Sms/tests/smsFormDataHelpers.test.js +0 -253
- package/v2Containers/SmsTrai/Edit/index.scss +0 -126
- package/v2Containers/Templates/TemplatesActionBar.js +0 -101
- package/v2Containers/Templates/tests/TemplatesActionBar.test.js +0 -120
- package/v2Containers/Templates/tests/smsTemplatesListApi.test.js +0 -180
- package/v2Containers/Templates/utils/smsTemplatesListApi.js +0 -79
- package/v2Containers/TemplatesV2/tests/TemplatesV2.localTemplates.test.js +0 -131
package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/SenderDetails.test.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {
|
|
3
|
-
render, screen, waitFor, within,
|
|
3
|
+
render, screen, waitFor, within,
|
|
4
4
|
} from '@testing-library/react';
|
|
5
5
|
import userEvent from '@testing-library/user-event';
|
|
6
6
|
import '@testing-library/jest-dom';
|
|
@@ -183,9 +183,9 @@ const WAIT_OPTIONS = { timeout: 10000 };
|
|
|
183
183
|
|
|
184
184
|
async function openSelectAndChoose(root, comboIndex, optionText) {
|
|
185
185
|
const combos = within(root).getAllByRole('combobox');
|
|
186
|
-
|
|
186
|
+
await userEvent.click(combos[comboIndex]);
|
|
187
187
|
await waitFor(() => expect(screen.getByRole('listbox')).toBeInTheDocument(), WAIT_OPTIONS);
|
|
188
|
-
|
|
188
|
+
await userEvent.click(await findVisibleSelectOption(optionText, WAIT_OPTIONS));
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
describe('SenderDetails', () => {
|
|
@@ -334,7 +334,7 @@ describe('SenderDetails', () => {
|
|
|
334
334
|
await waitFor(() => expect(within(root).getByText('beta@other.com')).toBeInTheDocument());
|
|
335
335
|
|
|
336
336
|
const resetLinks = within(root).getAllByText('Reset');
|
|
337
|
-
|
|
337
|
+
await userEvent.click(resetLinks[0]);
|
|
338
338
|
|
|
339
339
|
await waitFor(() => {
|
|
340
340
|
expect(within(root).getByText('alpha@brand.com')).toBeInTheDocument();
|
|
@@ -349,12 +349,12 @@ describe('SenderDetails', () => {
|
|
|
349
349
|
await waitFor(() => expect(within(root).getByText('+1002003001')).toBeInTheDocument());
|
|
350
350
|
|
|
351
351
|
const combos = within(root).getAllByRole('combobox');
|
|
352
|
-
|
|
352
|
+
await userEvent.click(combos[1]);
|
|
353
353
|
await waitFor(() => expect(screen.getByRole('listbox')).toBeInTheDocument(), WAIT_OPTIONS);
|
|
354
|
-
|
|
354
|
+
await userEvent.click(await findVisibleSelectOption('+1002003002', WAIT_OPTIONS));
|
|
355
355
|
|
|
356
356
|
const resetLinks = within(root).getAllByText('Reset');
|
|
357
|
-
|
|
357
|
+
await userEvent.click(resetLinks[1]);
|
|
358
358
|
|
|
359
359
|
await waitFor(() => expect(within(root).getByText('+1002003001')).toBeInTheDocument());
|
|
360
360
|
});
|
|
@@ -370,13 +370,13 @@ describe('SenderDetails', () => {
|
|
|
370
370
|
await waitFor(() => expect(within(root).getByText('My Business')).toBeInTheDocument());
|
|
371
371
|
|
|
372
372
|
const combos = within(root).getAllByRole('combobox');
|
|
373
|
-
|
|
373
|
+
await userEvent.click(combos[combos.length - 1]);
|
|
374
374
|
await waitFor(() => expect(screen.getByRole('listbox')).toBeInTheDocument(), WAIT_OPTIONS);
|
|
375
|
-
|
|
375
|
+
await userEvent.click(await findVisibleSelectOption('+91900111333', WAIT_OPTIONS));
|
|
376
376
|
|
|
377
377
|
const saveBtn = within(root).getByRole('button', { name: /save changes/i });
|
|
378
378
|
await waitFor(() => expect(saveBtn).not.toBeDisabled());
|
|
379
|
-
|
|
379
|
+
await userEvent.click(saveBtn);
|
|
380
380
|
|
|
381
381
|
expect(onSave).toHaveBeenCalledWith(
|
|
382
382
|
expect.objectContaining({
|
|
@@ -425,9 +425,9 @@ describe('SenderDetails', () => {
|
|
|
425
425
|
await waitFor(() => expect(within(root).getByText('Gateway A')).toBeInTheDocument());
|
|
426
426
|
|
|
427
427
|
const combos = within(root).getAllByRole('combobox');
|
|
428
|
-
|
|
428
|
+
await userEvent.click(combos[0]);
|
|
429
429
|
await waitFor(() => expect(screen.getByRole('listbox')).toBeInTheDocument(), WAIT_OPTIONS);
|
|
430
|
-
|
|
430
|
+
await userEvent.click(await findVisibleSelectOption('Gateway B', WAIT_OPTIONS));
|
|
431
431
|
|
|
432
432
|
// The sender ID should now auto-update to Gateway B's sender
|
|
433
433
|
await waitFor(() => expect(within(root).getByText('+222')).toBeInTheDocument());
|
|
@@ -444,9 +444,9 @@ describe('SenderDetails', () => {
|
|
|
444
444
|
|
|
445
445
|
// Switch to Mail Beta domain
|
|
446
446
|
const combos = within(root).getAllByRole('combobox');
|
|
447
|
-
|
|
447
|
+
await userEvent.click(combos[0]);
|
|
448
448
|
await waitFor(() => expect(screen.getByRole('listbox')).toBeInTheDocument(), WAIT_OPTIONS);
|
|
449
|
-
|
|
449
|
+
await userEvent.click(await findVisibleSelectOption('Mail Beta', WAIT_OPTIONS));
|
|
450
450
|
|
|
451
451
|
// Sender ID should auto-update to beta@other.com
|
|
452
452
|
await waitFor(() => expect(within(root).getByText('beta@other.com')).toBeInTheDocument());
|
|
@@ -468,13 +468,13 @@ describe('SenderDetails', () => {
|
|
|
468
468
|
// Change sender to enable save
|
|
469
469
|
const combos = within(root).getAllByRole('combobox');
|
|
470
470
|
const senderCombo = combos[combos.length - 1];
|
|
471
|
-
|
|
471
|
+
await userEvent.click(senderCombo);
|
|
472
472
|
await waitFor(() => expect(screen.getByRole('listbox')).toBeInTheDocument(), WAIT_OPTIONS);
|
|
473
|
-
|
|
473
|
+
await userEvent.click(await findVisibleSelectOption('+91900111333', WAIT_OPTIONS));
|
|
474
474
|
|
|
475
475
|
const saveBtn = within(root).getByRole('button', { name: /save changes/i });
|
|
476
476
|
await waitFor(() => expect(saveBtn).not.toBeDisabled());
|
|
477
|
-
|
|
477
|
+
await userEvent.click(saveBtn);
|
|
478
478
|
|
|
479
479
|
// Should have called onSave with whatsappDomainId derived from the matched WABA domain
|
|
480
480
|
expect(onSave).toHaveBeenCalledWith(
|
|
@@ -507,9 +507,9 @@ describe('SenderDetails', () => {
|
|
|
507
507
|
// Change to an alternate sender
|
|
508
508
|
const combos = within(root).getAllByRole('combobox');
|
|
509
509
|
const senderCombo = combos[combos.length - 1];
|
|
510
|
-
|
|
510
|
+
await userEvent.click(senderCombo);
|
|
511
511
|
await waitFor(() => expect(screen.getByRole('listbox')).toBeInTheDocument(), WAIT_OPTIONS);
|
|
512
|
-
|
|
512
|
+
await userEvent.click(await findVisibleSelectOption('+viber-alt', WAIT_OPTIONS));
|
|
513
513
|
|
|
514
514
|
// antd v6 also renders selected option in an aria-live polite region for
|
|
515
515
|
// screen readers, so the text appears twice. Match only the visible select
|
|
@@ -521,7 +521,7 @@ describe('SenderDetails', () => {
|
|
|
521
521
|
// Now click reset — for viberSenderId the else branch in handleReset is hit
|
|
522
522
|
// (viberSenderId is not smsDomain/emailDomain, so getDefaultValueForField returns '')
|
|
523
523
|
const resetLinks = within(root).getAllByText('Reset');
|
|
524
|
-
|
|
524
|
+
await userEvent.click(resetLinks[resetLinks.length - 1]);
|
|
525
525
|
// After reset, the field goes to the default value returned by getDefaultValueForField
|
|
526
526
|
// For viberSenderId this is '' (no specific default handler). The visible
|
|
527
527
|
// select tile no longer shows +viber-alt; the aria-live polite span may
|
|
@@ -3,7 +3,6 @@ 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';
|
|
7
6
|
import cloneDeep from 'lodash/cloneDeep';
|
|
8
7
|
import TemplatesV2 from '../TemplatesV2';
|
|
9
8
|
import TemplatePreview from '../../v2Components/TemplatePreview';
|
|
@@ -26,7 +25,6 @@ import Viber from '../Viber';
|
|
|
26
25
|
import Whatsapp from '../Whatsapp';
|
|
27
26
|
import InApp from '../InApp';
|
|
28
27
|
import Rcs from '../Rcs';
|
|
29
|
-
import { isRcsTextOnlyCardMediaType, resolveRcsCardPreviewStrings } from '../Rcs/utils';
|
|
30
28
|
import { getWhatsappContent } from '../Whatsapp/utils';
|
|
31
29
|
import * as commonUtil from '../../utils/common';
|
|
32
30
|
import Zalo from '../Zalo';
|
|
@@ -182,8 +180,6 @@ export function SlideBoxContent(props) {
|
|
|
182
180
|
isTestAndPreviewMode,
|
|
183
181
|
onHtmlEditorValidationStateChange,
|
|
184
182
|
} = props;
|
|
185
|
-
const localTemplatesConfig = props.localTemplatesConfig || pick(props, constants.LOCAL_TEMPLATE_CONFIG_KEYS);
|
|
186
|
-
const useLocalTemplates = !!get(localTemplatesConfig, 'useLocalTemplates');
|
|
187
183
|
const type = (messageDetails.type || '').toLowerCase(); // type is context in get tags values : outbound | dvs | referral | loyalty | coupons
|
|
188
184
|
const query = { type: !isFullMode && 'embedded', module: isFullMode ? 'default' : 'library', isEditFromCampaigns: (templateData || {}).isEditFromCampaigns};
|
|
189
185
|
const creativesLocationProps = {
|
|
@@ -403,37 +399,12 @@ export function SlideBoxContent(props) {
|
|
|
403
399
|
}
|
|
404
400
|
case constants.RCS: {
|
|
405
401
|
const template = cloneDeep(templateDataObject);
|
|
406
|
-
const
|
|
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
|
+
const { description = "", media: { mediaUrl = "" } = {}, title = "", suggestions = [] } = get(template, 'versions.base.content.RCS.rcsContent.cardContent[0]', {});
|
|
432
403
|
return {
|
|
433
404
|
rcsPreviewContent: {
|
|
434
405
|
rcsImageSrc: mediaUrl,
|
|
435
|
-
rcsTitle,
|
|
436
|
-
rcsDesc,
|
|
406
|
+
rcsTitle: title,
|
|
407
|
+
rcsDesc: description,
|
|
437
408
|
...(suggestions.length > 0 && {
|
|
438
409
|
buttonText: suggestions[0]?.text,
|
|
439
410
|
}),
|
|
@@ -459,7 +430,7 @@ export function SlideBoxContent(props) {
|
|
|
459
430
|
|
|
460
431
|
return (
|
|
461
432
|
<CreativesWrapper>
|
|
462
|
-
{slidBoxContent === 'templates' && (
|
|
433
|
+
{!isFullMode && slidBoxContent === 'templates' && (
|
|
463
434
|
<TemplatesV2
|
|
464
435
|
isFullMode={isFullMode}
|
|
465
436
|
onSelectTemplate={onSelectTemplate}
|
|
@@ -492,7 +463,6 @@ export function SlideBoxContent(props) {
|
|
|
492
463
|
waitEventContextTags={waitEventContextTags}
|
|
493
464
|
loyaltyMetaData={loyaltyMetaData}
|
|
494
465
|
isLoyaltyModule={isLoyaltyModule}
|
|
495
|
-
localTemplatesConfig={localTemplatesConfig}
|
|
496
466
|
/>
|
|
497
467
|
)}
|
|
498
468
|
{isPreview && (
|
|
@@ -663,7 +633,6 @@ export function SlideBoxContent(props) {
|
|
|
663
633
|
route={{ name: 'sms' }}
|
|
664
634
|
isCreateSms={isCreateSms}
|
|
665
635
|
isComponent
|
|
666
|
-
templateData={templateData}
|
|
667
636
|
isGetFormData={isGetFormData}
|
|
668
637
|
getFormSubscriptionData={getFormData}
|
|
669
638
|
getLiquidTags={getLiquidTags}
|
|
@@ -681,6 +650,9 @@ export function SlideBoxContent(props) {
|
|
|
681
650
|
restrictPersonalization={restrictPersonalization}
|
|
682
651
|
isAnonymousType={isAnonymousType}
|
|
683
652
|
waitEventContextTags={waitEventContextTags}
|
|
653
|
+
showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
|
|
654
|
+
handleTestAndPreview={handleTestAndPreview}
|
|
655
|
+
handleCloseTestAndPreview={handleCloseTestAndPreview}
|
|
684
656
|
/>
|
|
685
657
|
)}
|
|
686
658
|
|
|
@@ -1270,7 +1242,6 @@ export function SlideBoxContent(props) {
|
|
|
1270
1242
|
)}
|
|
1271
1243
|
{isCreateRcs && (<Rcs
|
|
1272
1244
|
{...rcsCommonProps}
|
|
1273
|
-
templateData={templateData}
|
|
1274
1245
|
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
1275
1246
|
showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
|
|
1276
1247
|
handleTestAndPreview={handleTestAndPreview}
|
|
@@ -49,8 +49,6 @@ function SlideBoxFooter(props) {
|
|
|
49
49
|
isAnonymousType = false,
|
|
50
50
|
templateData = {},
|
|
51
51
|
hasPersonalizationTokenError: hasPersonalizationTokenErrorProp = false,
|
|
52
|
-
/** When set (e.g. SMS library create), overrides `creativesTemplatesSave` (“Done”) for the primary button */
|
|
53
|
-
primarySaveButtonMessage,
|
|
54
52
|
} = props;
|
|
55
53
|
// Calculate if buttons should be disabled
|
|
56
54
|
// Only apply validation state checks for EMAIL channel in HTML Editor mode (not BEE/DragDrop)
|
|
@@ -167,12 +165,6 @@ function SlideBoxFooter(props) {
|
|
|
167
165
|
// Use prop from parent (FormBuilder flow) when available; else fall back to templateData check
|
|
168
166
|
const hasPersonalizationTokenError = hasPersonalizationTokenErrorProp === true || (restrictPersonalization && hasPersonalizationTokens());
|
|
169
167
|
|
|
170
|
-
function getSaveButtonLabel() {
|
|
171
|
-
if (primarySaveButtonMessage) return <FormattedMessage {...primarySaveButtonMessage} />;
|
|
172
|
-
if (isFullMode) return getFullModeSaveBtn(slidBoxContent, isCreatingTemplate);
|
|
173
|
-
return <FormattedMessage {...messages.creativesTemplatesSave} />;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
168
|
return (
|
|
177
169
|
<div className="template-footer-width">
|
|
178
170
|
{shouldShowErrorInfoNote && (
|
|
@@ -195,7 +187,11 @@ function SlideBoxFooter(props) {
|
|
|
195
187
|
onClick={onSave}
|
|
196
188
|
disabled={isTemplateNameEmpty || fetchingCmsData || shouldDisableButtons || hasPersonalizationTokenError}
|
|
197
189
|
>
|
|
198
|
-
{
|
|
190
|
+
{isFullMode ? (
|
|
191
|
+
getFullModeSaveBtn(slidBoxContent, isCreatingTemplate)
|
|
192
|
+
) : (
|
|
193
|
+
<FormattedMessage {...messages.creativesTemplatesSave} />
|
|
194
|
+
)}
|
|
199
195
|
</CapButton>
|
|
200
196
|
{showTestAndPreviewButton && (
|
|
201
197
|
<CapButton
|
|
@@ -268,10 +264,6 @@ SlideBoxFooter.propTypes = {
|
|
|
268
264
|
templateData: PropTypes.object,
|
|
269
265
|
formData: PropTypes.array,
|
|
270
266
|
hasPersonalizationTokenError: PropTypes.bool,
|
|
271
|
-
primarySaveButtonMessage: PropTypes.shape({
|
|
272
|
-
id: PropTypes.string,
|
|
273
|
-
defaultMessage: PropTypes.string,
|
|
274
|
-
}),
|
|
275
267
|
};
|
|
276
268
|
|
|
277
269
|
SlideBoxFooter.defaultProps = {
|
|
@@ -299,6 +291,5 @@ SlideBoxFooter.defaultProps = {
|
|
|
299
291
|
selectedEmailCreateMode: '',
|
|
300
292
|
formData: [],
|
|
301
293
|
hasPersonalizationTokenError: false,
|
|
302
|
-
primarySaveButtonMessage: undefined,
|
|
303
294
|
};
|
|
304
295
|
export default SlideBoxFooter;
|
|
@@ -16,7 +16,6 @@ import { isTraiDLTEnable } from '../../utils/common';
|
|
|
16
16
|
import { formatString } from '../../utils/Formatter';
|
|
17
17
|
import {
|
|
18
18
|
CAP_SPACE_12,
|
|
19
|
-
CAP_SPACE_16,
|
|
20
19
|
ICON_SIZE_M,
|
|
21
20
|
} from '@capillarytech/cap-ui-library/styled/variables';
|
|
22
21
|
import { WHATSAPP_HELP_DOC_LINK, JOURNEY } from './constants';
|
|
@@ -29,7 +28,7 @@ const StyledLabel = styled(CapLabelInline)`
|
|
|
29
28
|
// the inherited font-size. Pin it to the medium icon size (24px) and center it so
|
|
30
29
|
// the back arrow matches the header title instead of collapsing to a tiny glyph.
|
|
31
30
|
const PrefixWrapper = styled.div`
|
|
32
|
-
margin-right:
|
|
31
|
+
margin-right: 16px;
|
|
33
32
|
display: inline-flex;
|
|
34
33
|
align-items: center;
|
|
35
34
|
font-size: ${ICON_SIZE_M};
|
|
@@ -41,25 +40,7 @@ const renderData = (type, value, channel) => (
|
|
|
41
40
|
);
|
|
42
41
|
|
|
43
42
|
export function SlideBoxHeader(props) {
|
|
44
|
-
const {
|
|
45
|
-
slidBoxContent,
|
|
46
|
-
templateData,
|
|
47
|
-
onShowTemplates,
|
|
48
|
-
creativesMode,
|
|
49
|
-
isFullMode,
|
|
50
|
-
showPrefix,
|
|
51
|
-
shouldShowTemplateName,
|
|
52
|
-
channel,
|
|
53
|
-
templateNameRenderProp,
|
|
54
|
-
weChatTemplateType,
|
|
55
|
-
onWeChatMaptemplateStepChange,
|
|
56
|
-
weChatMaptemplateStep,
|
|
57
|
-
templateStep,
|
|
58
|
-
smsRegister,
|
|
59
|
-
handleClose,
|
|
60
|
-
moduleType,
|
|
61
|
-
useLocalTemplates = false,
|
|
62
|
-
} = props;
|
|
43
|
+
const { slidBoxContent, templateData, onShowTemplates, creativesMode, isFullMode, showPrefix, shouldShowTemplateName, channel, templateNameRenderProp, weChatTemplateType, onWeChatMaptemplateStepChange, weChatMaptemplateStep, templateStep, smsRegister, handleClose, moduleType } = props;
|
|
63
44
|
const showTemplateNameHeader = isFullMode && shouldShowTemplateName;
|
|
64
45
|
const mapTemplateCreate = !showTemplateNameHeader && slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
|
|
65
46
|
const isTraiDlt = isTraiDLTEnable(isFullMode, smsRegister);
|
|
@@ -80,7 +61,7 @@ export function SlideBoxHeader(props) {
|
|
|
80
61
|
} = templateData || {};
|
|
81
62
|
const templateName = whatsappTemplateName || templateData?.name;
|
|
82
63
|
const showRcsTemplateName = channel.toLowerCase() === RCS && slidBoxContent === 'editTemplate' && !isFullMode && templateName;
|
|
83
|
-
const showTemplateName = isWhatsappEdit || isZaloEdit;
|
|
64
|
+
const showTemplateName = isWhatsappEdit || showRcsTemplateName || isZaloEdit;
|
|
84
65
|
const whatsappCategory = whatsappTemplateCategory || get(templateData, `versions.base.content.whatsapp.category`, '');
|
|
85
66
|
const whatsappLanguageCode = whatsappTemplateLanguageCode || get(templateData, `versions.base.content.whatsapp.languages[0].language`, '');
|
|
86
67
|
|
|
@@ -107,9 +88,6 @@ export function SlideBoxHeader(props) {
|
|
|
107
88
|
window.open(WHATSAPP_HELP_DOC_LINK, '_blank');
|
|
108
89
|
};
|
|
109
90
|
|
|
110
|
-
const showCreativesTemplatesBackButton =
|
|
111
|
-
!isFullMode && (moduleType === JOURNEY || useLocalTemplates);
|
|
112
|
-
|
|
113
91
|
return (
|
|
114
92
|
<div key="creatives-container-slidebox-header-content">
|
|
115
93
|
{slidBoxContent === 'templates' && !showTemplateNameHeader && (
|
|
@@ -118,7 +96,7 @@ export function SlideBoxHeader(props) {
|
|
|
118
96
|
description={![NO_COMMUNICATION, FTP].includes(channel) &&
|
|
119
97
|
<FormattedMessage {...messages.creativeTemplatesDesc} />
|
|
120
98
|
}
|
|
121
|
-
prefix={
|
|
99
|
+
prefix={!isFullMode && moduleType === JOURNEY &&
|
|
122
100
|
<PrefixWrapper>
|
|
123
101
|
<CapIcons.BackIcon onClick={handleClose} />
|
|
124
102
|
</PrefixWrapper>
|
|
@@ -152,12 +130,6 @@ export function SlideBoxHeader(props) {
|
|
|
152
130
|
<StyledLabel className='whatsapp-rcs-slidebox-template-name' type="label2">{templateName}</StyledLabel>
|
|
153
131
|
</>
|
|
154
132
|
) : ""}
|
|
155
|
-
{showRcsTemplateName && (
|
|
156
|
-
<>
|
|
157
|
-
{renderData("label1", <FormattedMessage {...globalMessages.creativeNameLabel} />, channel)}
|
|
158
|
-
<StyledLabel className='whatsapp-rcs-slidebox-template-name' type="label2">{templateName}</StyledLabel>
|
|
159
|
-
</>
|
|
160
|
-
)}
|
|
161
133
|
{isWhatsappEdit && (
|
|
162
134
|
<>
|
|
163
135
|
{renderData("label3", <FormattedMessage {...whatsppMsg.labelSeperator} />)}
|
|
@@ -170,7 +142,7 @@ export function SlideBoxHeader(props) {
|
|
|
170
142
|
}
|
|
171
143
|
</>
|
|
172
144
|
}
|
|
173
|
-
prefix={!isFullMode && showPrefix &&
|
|
145
|
+
prefix={creativesMode !== 'edit' && !isFullMode && showPrefix &&
|
|
174
146
|
<PrefixWrapper>
|
|
175
147
|
<CapIcons.BackIcon onClick={onShowTemplates} />
|
|
176
148
|
</PrefixWrapper>
|
|
@@ -226,8 +198,5 @@ SlideBoxHeader.propTypes = {
|
|
|
226
198
|
shouldShowTemplateName: PropTypes.bool,
|
|
227
199
|
templateNameRenderProp: PropTypes.func,
|
|
228
200
|
smsRegister: PropTypes.any,
|
|
229
|
-
handleClose: PropTypes.func,
|
|
230
|
-
moduleType: PropTypes.string,
|
|
231
|
-
useLocalTemplates: PropTypes.bool,
|
|
232
201
|
};
|
|
233
202
|
export default SlideBoxHeader;
|
|
@@ -73,14 +73,3 @@ export const ALLOWED_CHANNELS_FOR_ANONYMOUS = ['mobilepush', 'webpush'];
|
|
|
73
73
|
export const ALL_CHANNELS_NEW = [
|
|
74
74
|
'sms', 'email', 'whatsapp', 'facebook', 'line', 'viber', 'rcs', 'zalo', 'inapp', 'call_task', 'ftp',
|
|
75
75
|
];
|
|
76
|
-
|
|
77
|
-
export const LOCAL_TEMPLATE_CONFIG_KEYS = ['useLocalTemplates', 'localTemplates', 'localTemplatesLoading', 'localTemplatesFilterContent', 'localTemplatesUseSkeleton', 'localTemplatesOnPageChange'];
|
|
78
|
-
|
|
79
|
-
/** Keys passed from parents into `Templates` when using local SMS template list (extends `LOCAL_TEMPLATE_CONFIG_KEYS`). */
|
|
80
|
-
export const LOCAL_TEMPLATE_CONFIG_KEYS_FOR_PICK = [
|
|
81
|
-
...LOCAL_TEMPLATE_CONFIG_KEYS,
|
|
82
|
-
'localTemplatesLoadingTip',
|
|
83
|
-
'localTemplatesFooterContent',
|
|
84
|
-
];
|
|
85
|
-
|
|
86
|
-
export const DEFAULT_SMS_TEMPLATE_NAME = 'Campaign message SMS content';
|