@capillarytech/creatives-library 9.0.14 → 9.0.15-alpha.1
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 +32 -0
- package/global-styles.js +1 -1
- package/package.json +1 -1
- package/services/tests/api.test.js +35 -20
- package/utils/common.js +8 -0
- package/utils/commonUtils.js +19 -1
- package/utils/rcsPayloadUtils.js +92 -0
- package/utils/templateVarUtils.js +201 -0
- package/utils/tests/rcsPayloadUtils.test.js +226 -0
- package/utils/tests/templateVarUtils.test.js +204 -0
- package/v2Components/CapActionButton/constants.js +7 -0
- package/v2Components/CapActionButton/index.js +168 -109
- package/v2Components/CapActionButton/index.scss +156 -5
- package/v2Components/CapActionButton/messages.js +19 -3
- package/v2Components/CapActionButton/tests/index.test.js +42 -18
- package/v2Components/CapImageUpload/index.js +2 -2
- package/v2Components/CapTagList/index.js +10 -0
- package/v2Components/CommonTestAndPreview/CustomValuesEditor.js +70 -48
- package/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +8 -2
- package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +214 -21
- package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +16 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +83 -9
- package/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +30 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +60 -11
- package/v2Components/CommonTestAndPreview/SendTestMessage.js +10 -5
- package/v2Components/CommonTestAndPreview/UnifiedPreview/RcsPreviewContent.js +201 -23
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +355 -76
- package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +155 -8
- package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +11 -0
- package/v2Components/CommonTestAndPreview/constants.js +38 -2
- package/v2Components/CommonTestAndPreview/index.js +761 -222
- package/v2Components/CommonTestAndPreview/messages.js +45 -3
- package/v2Components/CommonTestAndPreview/previewApiUtils.js +59 -0
- package/v2Components/CommonTestAndPreview/sagas.js +25 -6
- package/v2Components/CommonTestAndPreview/tests/CommonTestAndPreview.addTestCustomer.test.js +1 -0
- package/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +284 -267
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +231 -65
- 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/PreviewSection.test.js +8 -1
- package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +34 -13
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/RcsPreviewContent.test.js +281 -283
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +199 -1
- package/v2Components/CommonTestAndPreview/tests/index.test.js +133 -4
- package/v2Components/CommonTestAndPreview/tests/previewApiUtils.test.js +67 -0
- package/v2Components/CommonTestAndPreview/tests/sagas.test.js +31 -24
- package/v2Components/CommonTestAndPreview/utils.js +84 -0
- package/v2Components/FormBuilder/Classic.js +4487 -0
- package/v2Components/FormBuilder/Functional/FormBuilderShell.js +366 -0
- package/v2Components/FormBuilder/Functional/channels/registry.js +17 -0
- package/v2Components/FormBuilder/Functional/channels/sms/buildSubmitPayload.js +9 -0
- package/v2Components/FormBuilder/Functional/channels/sms/config.js +30 -0
- package/v2Components/FormBuilder/Functional/channels/sms/getEditorErrorDescriptor.js +46 -0
- package/v2Components/FormBuilder/Functional/channels/sms/getLiquidContent.js +13 -0
- package/v2Components/FormBuilder/Functional/channels/sms/index.js +22 -0
- package/v2Components/FormBuilder/Functional/channels/sms/tests/getEditorErrorDescriptor.test.js +52 -0
- package/v2Components/FormBuilder/Functional/channels/sms/tests/getLiquidContent.test.js +25 -0
- package/v2Components/FormBuilder/Functional/channels/sms/tests/validate.test.js +87 -0
- package/v2Components/FormBuilder/Functional/channels/sms/validate.js +89 -0
- package/v2Components/FormBuilder/Functional/constants.js +42 -0
- package/v2Components/FormBuilder/Functional/core/schema/fieldRegistry.js +38 -0
- package/v2Components/FormBuilder/Functional/core/schema/initializeFormState.js +85 -0
- package/v2Components/FormBuilder/Functional/core/store/formReducer.js +81 -0
- package/v2Components/FormBuilder/Functional/core/store/selectors.js +30 -0
- package/v2Components/FormBuilder/Functional/core/store/toLegacyFormData.js +91 -0
- package/v2Components/FormBuilder/Functional/index.js +26 -0
- package/v2Components/FormBuilder/Functional/layout/FieldSlot.js +59 -0
- package/v2Components/FormBuilder/Functional/layout/SchemaForm.js +31 -0
- package/v2Components/FormBuilder/Functional/layout/Section.js +116 -0
- package/v2Components/FormBuilder/Functional/renderers/smsRenderers.js +258 -0
- package/v2Components/FormBuilder/Functional/tests/channelRegistry.test.js +21 -0
- package/v2Components/FormBuilder/Functional/tests/fieldRegistry.test.js +65 -0
- package/v2Components/FormBuilder/Functional/tests/fieldSlot.test.js +97 -0
- package/v2Components/FormBuilder/Functional/tests/fixtures/smsParityCases.js +192 -0
- package/v2Components/FormBuilder/Functional/tests/formReducer.test.js +129 -0
- package/v2Components/FormBuilder/Functional/tests/initializeFormState.test.js +132 -0
- package/v2Components/FormBuilder/Functional/tests/schemaForm.test.js +40 -0
- package/v2Components/FormBuilder/Functional/tests/section.test.js +99 -0
- package/v2Components/FormBuilder/Functional/tests/selectors.test.js +67 -0
- package/v2Components/FormBuilder/Functional/tests/sms.crossFlowParity.test.js +155 -0
- package/v2Components/FormBuilder/Functional/tests/sms.liquid.test.js +172 -0
- package/v2Components/FormBuilder/Functional/tests/sms.rollout.test.js +122 -0
- package/v2Components/FormBuilder/Functional/tests/sms.shell.parity.test.js +329 -0
- package/v2Components/FormBuilder/Functional/tests/smsRenderers.test.js +160 -0
- package/v2Components/FormBuilder/Functional/tests/toLegacyFormData.test.js +95 -0
- package/v2Components/FormBuilder/_formBuilder.scss +5 -0
- package/v2Components/FormBuilder/index.js +41 -4479
- package/v2Components/FormBuilder/tests/__snapshots__/sms.characterization.test.js.snap +114 -0
- package/v2Components/FormBuilder/tests/entryGate.test.js +106 -0
- package/v2Components/FormBuilder/tests/sms.characterization.test.js +336 -0
- package/v2Components/SmsFallback/SmsFallbackLocalSelector.js +91 -0
- package/v2Components/SmsFallback/constants.js +94 -0
- package/v2Components/SmsFallback/index.js +958 -0
- package/v2Components/SmsFallback/index.scss +266 -0
- package/v2Components/SmsFallback/messages.js +78 -0
- package/v2Components/SmsFallback/smsFallbackUtils.js +120 -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 +208 -0
- package/v2Components/SmsFallback/tests/smsFallbackUtils.test.js +309 -0
- package/v2Components/SmsFallback/tests/useLocalTemplateList.test.js +422 -0
- package/v2Components/SmsFallback/useLocalTemplateList.js +92 -0
- package/v2Components/TemplatePreview/_templatePreview.scss +41 -22
- package/v2Components/TemplatePreview/constants.js +2 -0
- package/v2Components/TemplatePreview/index.js +143 -31
- package/v2Components/TemplatePreview/tests/index.test.js +142 -0
- package/v2Components/TestAndPreviewSlidebox/CustomValuesEditor.js +6 -6
- package/v2Components/TestAndPreviewSlidebox/index.js +13 -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/CommunicationFlow/Tests/CommunicationFlow.test.js +4 -1
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/DeliverySettingsSection.test.js +4 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/SenderDetails.test.js +20 -20
- package/v2Containers/CreativesContainer/CreativesSlideBoxWrapper.js +17 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +36 -4
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +14 -5
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +36 -5
- package/v2Containers/CreativesContainer/constants.js +11 -0
- package/v2Containers/CreativesContainer/embeddedSlideboxUtils.js +79 -0
- package/v2Containers/CreativesContainer/index.js +323 -104
- package/v2Containers/CreativesContainer/index.scss +83 -1
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.localTemplates.test.js +90 -0
- package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +79 -34
- package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +79 -16
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +8 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +333 -90
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +20 -15
- 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/MobilePush/Create/test/saga.test.js +2 -2
- package/v2Containers/Rcs/constants.js +131 -11
- package/v2Containers/Rcs/index.js +2602 -807
- package/v2Containers/Rcs/index.scss +289 -8
- package/v2Containers/Rcs/messages.js +34 -3
- package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +227 -0
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +73535 -38537
- package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap +0 -8
- package/v2Containers/Rcs/tests/index.test.js +147 -36
- package/v2Containers/Rcs/tests/mockData.js +38 -0
- package/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +318 -0
- package/v2Containers/Rcs/tests/utils.test.js +646 -30
- package/v2Containers/Rcs/utils.js +478 -11
- package/v2Containers/Sms/Create/index.js +115 -48
- 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 +678 -169
- package/v2Containers/SmsTrai/Edit/index.scss +126 -0
- package/v2Containers/SmsTrai/Edit/messages.js +14 -4
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +5615 -3014
- 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 +171 -12
- package/v2Containers/Templates/actions.js +11 -0
- package/v2Containers/Templates/constants.js +2 -0
- package/v2Containers/Templates/index.js +125 -55
- package/v2Containers/Templates/sagas.js +57 -13
- package/v2Containers/Templates/tests/TemplatesActionBar.test.js +120 -0
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1060 -1015
- package/v2Containers/Templates/tests/sagas.test.js +199 -16
- 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/WeChat/MapTemplates/test/saga.test.js +9 -9
- package/v2Containers/Whatsapp/index.js +3 -20
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +578 -34
|
@@ -11,6 +11,7 @@ import PropTypes from 'prop-types';
|
|
|
11
11
|
import CapRow from '@capillarytech/cap-ui-library/CapRow';
|
|
12
12
|
import CapSpin from '@capillarytech/cap-ui-library/CapSpin';
|
|
13
13
|
import CapIcon from '@capillarytech/cap-ui-library/CapIcon';
|
|
14
|
+
import CapLabel from '@capillarytech/cap-ui-library/CapLabel';
|
|
14
15
|
import PreviewHeader from './PreviewHeader';
|
|
15
16
|
import DeviceFrame from './DeviceFrame';
|
|
16
17
|
import EmailPreviewContent from './EmailPreviewContent';
|
|
@@ -22,8 +23,21 @@ import MobilePushPreviewContent from './MobilePushPreviewContent';
|
|
|
22
23
|
import ViberPreviewContent from './ViberPreviewContent';
|
|
23
24
|
import ZaloPreviewContent from './ZaloPreviewContent';
|
|
24
25
|
import WebPushPreviewContent from './WebPushPreviewContent';
|
|
25
|
-
import
|
|
26
|
+
import CapTab from '@capillarytech/cap-ui-library/CapTab';
|
|
27
|
+
import {
|
|
28
|
+
CHANNELS,
|
|
29
|
+
DESKTOP,
|
|
30
|
+
TABLET,
|
|
31
|
+
MOBILE,
|
|
32
|
+
ANDROID,
|
|
33
|
+
IOS,
|
|
34
|
+
PREVIEW_TAB_RCS,
|
|
35
|
+
PREVIEW_TAB_SMS_FALLBACK,
|
|
36
|
+
PREVIEW_TAB_KEYS,
|
|
37
|
+
RCS_SMS_FALLBACK_VAR_MAPPED_PROP,
|
|
38
|
+
} from '../constants';
|
|
26
39
|
import messages from '../messages';
|
|
40
|
+
import { getFallbackResolvedContent } from '../../../utils/templateVarUtils';
|
|
27
41
|
import './_unifiedPreview.scss';
|
|
28
42
|
|
|
29
43
|
const UnifiedPreview = ({
|
|
@@ -39,7 +53,24 @@ const UnifiedPreview = ({
|
|
|
39
53
|
lastModified,
|
|
40
54
|
updatedByName,
|
|
41
55
|
showHeader, // Default to true for Test and Preview flow, false for channel component previews
|
|
56
|
+
smsFallbackContent,
|
|
57
|
+
smsFallbackResolvedText,
|
|
58
|
+
activePreviewTab,
|
|
59
|
+
onPreviewTabChange,
|
|
42
60
|
}) => {
|
|
61
|
+
const hasFallbackSmsTemplate = !!(smsFallbackContent?.templateContent || smsFallbackContent?.content);
|
|
62
|
+
const showRcsSmsFallbackTabs = channel === CHANNELS.RCS && hasFallbackSmsTemplate;
|
|
63
|
+
const rawFallbackTemplate = smsFallbackContent?.templateContent ?? smsFallbackContent?.content ?? '';
|
|
64
|
+
const rcsFallbackVarMapped = smsFallbackContent?.[RCS_SMS_FALLBACK_VAR_MAPPED_PROP] ?? {};
|
|
65
|
+
const hasRcsFallbackVarMapped = Object.keys(rcsFallbackVarMapped).length > 0;
|
|
66
|
+
// When no varmap is present, show raw template so {{tags}} remain visible in the preview.
|
|
67
|
+
// Only apply slot substitution when varmap entries exist or a resolved text is available.
|
|
68
|
+
const smsFallbackDisplayContent =
|
|
69
|
+
smsFallbackResolvedText != null && smsFallbackResolvedText !== ''
|
|
70
|
+
? smsFallbackResolvedText
|
|
71
|
+
: hasRcsFallbackVarMapped
|
|
72
|
+
? getFallbackResolvedContent(rawFallbackTemplate, rcsFallbackVarMapped)
|
|
73
|
+
: rawFallbackTemplate;
|
|
43
74
|
/**
|
|
44
75
|
* Render channel-specific preview content
|
|
45
76
|
* For Phase 5, we'll render placeholders
|
|
@@ -126,6 +157,21 @@ const UnifiedPreview = ({
|
|
|
126
157
|
case CHANNELS.RCS: {
|
|
127
158
|
// RCS content is an object with rcsTitle, rcsDesc, rcsImageSrc, suggestions, etc.
|
|
128
159
|
const rcsContent = typeof content === 'object' ? content : {};
|
|
160
|
+
|
|
161
|
+
if (showRcsSmsFallbackTabs && activePreviewTab === PREVIEW_TAB_SMS_FALLBACK) {
|
|
162
|
+
return (
|
|
163
|
+
<SmsPreviewContent
|
|
164
|
+
content={smsFallbackDisplayContent}
|
|
165
|
+
device={ANDROID}
|
|
166
|
+
isUpdating={isUpdating}
|
|
167
|
+
error={error}
|
|
168
|
+
formatMessage={formatMessage}
|
|
169
|
+
senderId={smsFallbackContent?.senderId}
|
|
170
|
+
showHeader={showHeader}
|
|
171
|
+
/>
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
|
|
129
175
|
return (
|
|
130
176
|
<RcsPreviewContent
|
|
131
177
|
content={rcsContent}
|
|
@@ -313,6 +359,96 @@ const UnifiedPreview = ({
|
|
|
313
359
|
* PreviewHeader is shown only when showHeader is true (for Test and Preview flow)
|
|
314
360
|
* Channel-specific content will be in separate files in future phases
|
|
315
361
|
*/
|
|
362
|
+
if (showRcsSmsFallbackTabs) {
|
|
363
|
+
const renderPane = ({ paneChannel, paneDevice, paneShowDeviceToggle, paneContent }) => (
|
|
364
|
+
<CapRow className="unified-preview-tab-pane">
|
|
365
|
+
{showHeader && (
|
|
366
|
+
<PreviewHeader
|
|
367
|
+
selectedCustomer={selectedCustomer}
|
|
368
|
+
device={paneDevice}
|
|
369
|
+
showDeviceToggle={paneShowDeviceToggle}
|
|
370
|
+
onDeviceChange={onDeviceChange}
|
|
371
|
+
channel={paneChannel}
|
|
372
|
+
/>
|
|
373
|
+
)}
|
|
374
|
+
|
|
375
|
+
<CapRow className={`preview-content-container ${!showHeader ? 'preview-content-container-no-header' : ''}`}>
|
|
376
|
+
{paneContent}
|
|
377
|
+
</CapRow>
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
</CapRow>
|
|
381
|
+
);
|
|
382
|
+
|
|
383
|
+
return (
|
|
384
|
+
<CapRow className="unified-preview unified-preview-rcs-tabs">
|
|
385
|
+
<CapTab
|
|
386
|
+
activeKey={activePreviewTab}
|
|
387
|
+
onChange={onPreviewTabChange}
|
|
388
|
+
panes={[
|
|
389
|
+
{
|
|
390
|
+
tab: formatMessage(messages.rcsTab),
|
|
391
|
+
key: PREVIEW_TAB_RCS,
|
|
392
|
+
content: renderPane({
|
|
393
|
+
paneChannel: CHANNELS.RCS,
|
|
394
|
+
paneDevice: device,
|
|
395
|
+
paneShowDeviceToggle: showDeviceToggle,
|
|
396
|
+
paneContent: (
|
|
397
|
+
<RcsPreviewContent
|
|
398
|
+
content={typeof content === 'object' ? content : {}}
|
|
399
|
+
device={device}
|
|
400
|
+
isUpdating={isUpdating}
|
|
401
|
+
error={error}
|
|
402
|
+
formatMessage={formatMessage}
|
|
403
|
+
senderId={content?.senderId}
|
|
404
|
+
showHeader={showHeader}
|
|
405
|
+
/>
|
|
406
|
+
),
|
|
407
|
+
}),
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
tab: formatMessage(messages.smsFallbackTab),
|
|
411
|
+
key: PREVIEW_TAB_SMS_FALLBACK,
|
|
412
|
+
content: renderPane({
|
|
413
|
+
paneChannel: CHANNELS.SMS,
|
|
414
|
+
paneDevice: device,
|
|
415
|
+
paneShowDeviceToggle: showDeviceToggle,
|
|
416
|
+
paneContent: (
|
|
417
|
+
<SmsPreviewContent
|
|
418
|
+
content={smsFallbackDisplayContent}
|
|
419
|
+
device={device}
|
|
420
|
+
isUpdating={isUpdating}
|
|
421
|
+
error={error}
|
|
422
|
+
formatMessage={formatMessage}
|
|
423
|
+
senderId={smsFallbackContent?.senderId}
|
|
424
|
+
showHeader={showHeader}
|
|
425
|
+
/>
|
|
426
|
+
),
|
|
427
|
+
}),
|
|
428
|
+
},
|
|
429
|
+
]}
|
|
430
|
+
/>
|
|
431
|
+
{(lastModified || updatedByName) && (
|
|
432
|
+
<CapRow className="preview-metadata">
|
|
433
|
+
{lastModified && (
|
|
434
|
+
<CapLabel className="metadata-item">
|
|
435
|
+
{formatMessage(messages.lastModified)}
|
|
436
|
+
:
|
|
437
|
+
{' '}
|
|
438
|
+
{lastModified}
|
|
439
|
+
</CapLabel>
|
|
440
|
+
)}
|
|
441
|
+
{updatedByName && (
|
|
442
|
+
<CapLabel className="metadata-item">
|
|
443
|
+
{formatMessage(messages.byAuthor, { name: updatedByName })}
|
|
444
|
+
</CapLabel>
|
|
445
|
+
)}
|
|
446
|
+
</CapRow>
|
|
447
|
+
)}
|
|
448
|
+
</CapRow>
|
|
449
|
+
);
|
|
450
|
+
}
|
|
451
|
+
|
|
316
452
|
return (
|
|
317
453
|
<CapRow className="unified-preview">
|
|
318
454
|
{/* PreviewHeader - shown only in Test and Preview flow, hidden in channel component previews */}
|
|
@@ -342,19 +478,17 @@ const UnifiedPreview = ({
|
|
|
342
478
|
{(lastModified || updatedByName) && (
|
|
343
479
|
<CapRow className="preview-metadata">
|
|
344
480
|
{lastModified && (
|
|
345
|
-
<
|
|
481
|
+
<CapLabel className="metadata-item">
|
|
346
482
|
{formatMessage(messages.lastModified)}
|
|
347
483
|
:
|
|
348
484
|
{' '}
|
|
349
485
|
{lastModified}
|
|
350
|
-
</
|
|
486
|
+
</CapLabel>
|
|
351
487
|
)}
|
|
352
488
|
{updatedByName && (
|
|
353
|
-
<
|
|
354
|
-
{formatMessage(messages.
|
|
355
|
-
|
|
356
|
-
{updatedByName}
|
|
357
|
-
</span>
|
|
489
|
+
<CapLabel className="metadata-item">
|
|
490
|
+
{formatMessage(messages.byAuthor, { name: updatedByName })}
|
|
491
|
+
</CapLabel>
|
|
358
492
|
)}
|
|
359
493
|
</CapRow>
|
|
360
494
|
)}
|
|
@@ -394,6 +528,15 @@ UnifiedPreview.propTypes = {
|
|
|
394
528
|
|
|
395
529
|
// Header display
|
|
396
530
|
showHeader: PropTypes.bool, // Show PreviewHeader (true for Test and Preview flow, false for channel component previews)
|
|
531
|
+
|
|
532
|
+
// RCS: SMS fallback preview support (same shape as SmsFallback / RCS smsFallbackData)
|
|
533
|
+
smsFallbackContent: PropTypes.shape({
|
|
534
|
+
templateContent: PropTypes.string,
|
|
535
|
+
senderId: PropTypes.string,
|
|
536
|
+
templateName: PropTypes.string,
|
|
537
|
+
}),
|
|
538
|
+
activePreviewTab: PropTypes.oneOf(PREVIEW_TAB_KEYS),
|
|
539
|
+
onPreviewTabChange: PropTypes.func,
|
|
397
540
|
};
|
|
398
541
|
|
|
399
542
|
UnifiedPreview.defaultProps = {
|
|
@@ -406,6 +549,10 @@ UnifiedPreview.defaultProps = {
|
|
|
406
549
|
lastModified: null,
|
|
407
550
|
updatedByName: null,
|
|
408
551
|
showHeader: true, // Default to true for Test and Preview flow
|
|
552
|
+
smsFallbackContent: null,
|
|
553
|
+
smsFallbackResolvedText: undefined,
|
|
554
|
+
activePreviewTab: PREVIEW_TAB_RCS,
|
|
555
|
+
onPreviewTabChange: () => {},
|
|
409
556
|
};
|
|
410
557
|
|
|
411
558
|
export default UnifiedPreview;
|
|
@@ -211,6 +211,10 @@
|
|
|
211
211
|
margin-right: 0.5rem;
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
+
.cap-slide-box-v2.common-test-and-preview-slidebox .cap-slide-box-v2-container {
|
|
215
|
+
z-index: 10030;
|
|
216
|
+
}
|
|
217
|
+
|
|
214
218
|
.common-test-and-preview-slidebox {
|
|
215
219
|
|
|
216
220
|
.ant-modal-mask,
|
|
@@ -485,6 +489,13 @@
|
|
|
485
489
|
}
|
|
486
490
|
}
|
|
487
491
|
|
|
492
|
+
.tags-section-title {
|
|
493
|
+
margin: $CAP_SPACE_12 0;
|
|
494
|
+
display: block;
|
|
495
|
+
color: $CAP_G01;
|
|
496
|
+
font-weight: $FONT_WEIGHT_MEDIUM;
|
|
497
|
+
}
|
|
498
|
+
|
|
488
499
|
.values-table {
|
|
489
500
|
margin-bottom: $CAP_SPACE_16;
|
|
490
501
|
border: $CAP_SPACE_01 solid $CAP_G12;
|
|
@@ -66,7 +66,6 @@ export const GET_WECRM_ACCOUNTS_REQUESTED = 'app/CommonTestAndPreview/GET_WECRM_
|
|
|
66
66
|
export const GET_WECRM_ACCOUNTS_SUCCESS = 'app/CommonTestAndPreview/GET_WECRM_ACCOUNTS_SUCCESS';
|
|
67
67
|
export const GET_WECRM_ACCOUNTS_FAILURE = 'app/CommonTestAndPreview/GET_WECRM_ACCOUNTS_FAILURE';
|
|
68
68
|
|
|
69
|
-
|
|
70
69
|
// ============================================
|
|
71
70
|
// CUSTOMER MODAL TYPE (test customer addition)
|
|
72
71
|
// ============================================
|
|
@@ -87,7 +86,44 @@ export const CHANNELS = {
|
|
|
87
86
|
ZALO: 'ZALO',
|
|
88
87
|
WEBPUSH: 'WEBPUSH',
|
|
89
88
|
};
|
|
90
|
-
|
|
89
|
+
|
|
90
|
+
/** Unified preview tab keys when RCS shows RCS + SMS fallback panes. */
|
|
91
|
+
export const PREVIEW_TAB_RCS = 'rcs';
|
|
92
|
+
export const PREVIEW_TAB_SMS_FALLBACK = 'smsFallback';
|
|
93
|
+
export const PREVIEW_TAB_KEYS = [PREVIEW_TAB_RCS, PREVIEW_TAB_SMS_FALLBACK];
|
|
94
|
+
|
|
95
|
+
/** Channels whose Test & Preview defaults to Android/iOS device frame (not desktop). */
|
|
96
|
+
export const CHANNELS_USING_ANDROID_PREVIEW_DEVICE = [
|
|
97
|
+
CHANNELS.SMS,
|
|
98
|
+
CHANNELS.WHATSAPP,
|
|
99
|
+
CHANNELS.RCS,
|
|
100
|
+
CHANNELS.INAPP,
|
|
101
|
+
CHANNELS.MOBILEPUSH,
|
|
102
|
+
CHANNELS.VIBER,
|
|
103
|
+
];
|
|
104
|
+
|
|
105
|
+
/** RCS createMessageMeta test payload — rich card envelope literals. */
|
|
106
|
+
export const RCS_TEST_META_CONTENT_TYPE_RICHCARD = 'RICHCARD';
|
|
107
|
+
export const RCS_TEST_META_CARD_TYPE_STANDALONE = 'STANDALONE';
|
|
108
|
+
export const RCS_TEST_META_CARD_ORIENTATION_VERTICAL = 'VERTICAL';
|
|
109
|
+
export const RCS_TEST_META_CARD_WIDTH_SMALL = 'SMALL';
|
|
110
|
+
|
|
111
|
+
/** React key fallback when a custom-values section has no `key` or title id. */
|
|
112
|
+
export const CUSTOM_VALUES_EDITOR_SECTION_FALLBACK_KEY = 'section';
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Matches at least one `{{variableName}}` token in SMS / RCS fallback template text.
|
|
116
|
+
*/
|
|
117
|
+
export const SMS_MUSTACHE_TAG_PATTERN = /\{\{[^}]+\}\}/;
|
|
118
|
+
|
|
119
|
+
/** TRAI DLT `{#…#}` placeholders (same idea as `COMBINED_SMS_TEMPLATE_VAR_REGEX` in unified constants). */
|
|
120
|
+
export const SMS_DLT_HASH_TAG_PATTERN = /\{\#[^#]*\#\}/;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Key on `smsFallbackContent` passed into Test & Preview — RCS slot map from SmsTraiEdit
|
|
124
|
+
* (`onRcsFallbackEditorStateChange`), merged before tag extraction like the embedded SMS editor.
|
|
125
|
+
*/
|
|
126
|
+
export const RCS_SMS_FALLBACK_VAR_MAPPED_PROP = 'rcsSmsFallbackVarMapped';
|
|
91
127
|
|
|
92
128
|
// ============================================
|
|
93
129
|
// DEVICE CONSTANTS
|