@capillarytech/creatives-library 9.0.54-alpha.4 → 9.0.55-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/package.json +1 -1
- package/v2Components/CommonTestAndPreview/index.js +1 -1
- package/v2Components/FormBuilder/Classic.js +2 -2
- package/v2Containers/CommunicationFlow/CommunicationFlow.scss +1 -1
- package/v2Containers/CommunicationFlow/CommunicationFlowCard.js +1 -1
- package/v2Containers/CommunicationFlow/Tests/CommunicationFlow.test.js +57 -1
- package/v2Containers/CommunicationFlow/constants.js +9 -0
- package/v2Containers/CreativesContainer/index.js +1 -1
- package/v2Containers/MobilePush/Edit/index.js +1 -2
package/package.json
CHANGED
|
@@ -4276,13 +4276,13 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
4276
4276
|
forceRender: true,
|
|
4277
4277
|
tab: (
|
|
4278
4278
|
<div className="form-tab-header" onInput={(e) => e.stopPropagation()}>
|
|
4279
|
-
{
|
|
4279
|
+
{
|
|
4280
4280
|
_.forEach(renderedContentSections, (value) => {
|
|
4281
4281
|
if (value) {
|
|
4282
4282
|
return value;
|
|
4283
4283
|
}
|
|
4284
4284
|
return value;
|
|
4285
|
-
})
|
|
4285
|
+
})
|
|
4286
4286
|
}
|
|
4287
4287
|
</div>
|
|
4288
4288
|
),
|
|
@@ -376,8 +376,11 @@ describe('handleSave — CCS flow', () => {
|
|
|
376
376
|
renderWithFlow({
|
|
377
377
|
features: {},
|
|
378
378
|
config: ccsConfig,
|
|
379
|
+
// messageBody is the legacy editor's field name for the typed SMS text
|
|
380
|
+
// (see CreativesContainer/index.js's getCreativesData SMS case) — the
|
|
381
|
+
// SMS transform maps it to CCS's `message` field.
|
|
379
382
|
initialData: {
|
|
380
|
-
contentItems: [{ channel: 'sms', templateData: {
|
|
383
|
+
contentItems: [{ channel: 'sms', templateData: { messageBody: 'Hello' } }],
|
|
381
384
|
},
|
|
382
385
|
onSave,
|
|
383
386
|
});
|
|
@@ -400,6 +403,59 @@ describe('handleSave — CCS flow', () => {
|
|
|
400
403
|
expect(onSave).toHaveBeenCalledTimes(1);
|
|
401
404
|
});
|
|
402
405
|
|
|
406
|
+
it('transforms SMS content from the legacy editor shape (messageBody) to CCS\'s message field', async () => {
|
|
407
|
+
const onSave = jest.fn();
|
|
408
|
+
renderWithFlow({
|
|
409
|
+
features: {},
|
|
410
|
+
config: ccsConfig,
|
|
411
|
+
initialData: {
|
|
412
|
+
contentItems: [{
|
|
413
|
+
channel: 'SMS',
|
|
414
|
+
templateData: { messageBody: 'Hello {{name}}', channel: 'SMS' },
|
|
415
|
+
}],
|
|
416
|
+
},
|
|
417
|
+
onSave,
|
|
418
|
+
});
|
|
419
|
+
|
|
420
|
+
await userEvent.click(screen.getByRole('button', { name: /^save$/i }));
|
|
421
|
+
|
|
422
|
+
await waitFor(() => expect(createCommDefinition).toHaveBeenCalledTimes(1));
|
|
423
|
+
expect(createCommDefinition).toHaveBeenCalledWith(
|
|
424
|
+
expect.objectContaining({
|
|
425
|
+
singleChannelStrategy: expect.objectContaining({
|
|
426
|
+
variant: expect.objectContaining({
|
|
427
|
+
channel: 'SMS',
|
|
428
|
+
smsMessageContent: {
|
|
429
|
+
channel: 'SMS',
|
|
430
|
+
message: 'Hello {{name}}',
|
|
431
|
+
},
|
|
432
|
+
}),
|
|
433
|
+
}),
|
|
434
|
+
}),
|
|
435
|
+
);
|
|
436
|
+
});
|
|
437
|
+
|
|
438
|
+
it('does not carry the legacy messageBody key into smsMessageContent (regression guard against reverting to pass-through)', async () => {
|
|
439
|
+
const onSave = jest.fn();
|
|
440
|
+
renderWithFlow({
|
|
441
|
+
features: {},
|
|
442
|
+
config: ccsConfig,
|
|
443
|
+
initialData: {
|
|
444
|
+
contentItems: [{
|
|
445
|
+
channel: 'SMS',
|
|
446
|
+
templateData: { messageBody: 'Hello {{name}}', channel: 'SMS' },
|
|
447
|
+
}],
|
|
448
|
+
},
|
|
449
|
+
onSave,
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
await userEvent.click(screen.getByRole('button', { name: /^save$/i }));
|
|
453
|
+
|
|
454
|
+
await waitFor(() => expect(createCommDefinition).toHaveBeenCalledTimes(1));
|
|
455
|
+
const payload = createCommDefinition.mock.calls[0][0];
|
|
456
|
+
expect(payload.singleChannelStrategy.variant.smsMessageContent).not.toHaveProperty('messageBody');
|
|
457
|
+
});
|
|
458
|
+
|
|
403
459
|
it('transforms EMAIL content from the legacy editor shape (emailSubject) to CCS\'s messageSubject', async () => {
|
|
404
460
|
const onSave = jest.fn();
|
|
405
461
|
renderWithFlow({
|
|
@@ -78,6 +78,15 @@ export const CCS_CONTENT_TRANSFORMS = {
|
|
|
78
78
|
messageSubject: templateData.emailSubject,
|
|
79
79
|
messageBody: templateData.emailBody || templateData.emailHtml,
|
|
80
80
|
}),
|
|
81
|
+
// SMS: legacy stores the typed text as `messageBody` (see
|
|
82
|
+
// CreativesContainer/index.js's getCreativesData SMS case, and the existing
|
|
83
|
+
// legacy smsMessageContent builder in utils/transformerUtils.js, both of
|
|
84
|
+
// which read/write this same field) — CCS's schema expects it as `message`
|
|
85
|
+
// (confirmed against a real CCS response showing smsMessageContent.message
|
|
86
|
+
// stayed null when messageBody was sent instead).
|
|
87
|
+
SMS: (templateData = {}) => ({
|
|
88
|
+
message: templateData.messageBody || '',
|
|
89
|
+
}),
|
|
81
90
|
// WEBPUSH: the legacy editor nests the real data under
|
|
82
91
|
// messageContent.content (see CommunicationFlowCard.js's own comment on
|
|
83
92
|
// this same wrapping, for the edit-mode case) — extracting it flat here
|
|
@@ -1139,8 +1139,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1139
1139
|
this.props.globalActions.addMessageToQueue(message);
|
|
1140
1140
|
} else {
|
|
1141
1141
|
const name = data.file.name.split('.');
|
|
1142
|
-
const
|
|
1143
|
-
const newFile = new File([blob], `${name[0]}${Date.now()}.${name[1]}`, {type: 'image'});
|
|
1142
|
+
const newFile = new File([data.file], `${name[0]}${Date.now()}.${name[1]}`, {type: 'image'});
|
|
1144
1143
|
this.props.actions.uploadAsset(newFile, data.type, data.fileParams);
|
|
1145
1144
|
}
|
|
1146
1145
|
};
|