@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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "9.0.54-alpha.4",
4
+ "version": "9.0.55-alpha.0",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -3813,7 +3813,7 @@ const CommonTestAndPreview = (props) => {
3813
3813
  header={slideboxHeader}
3814
3814
  handleClose={handleClose}
3815
3815
  show={show}
3816
- size="size-xl"
3816
+ size="size-l"
3817
3817
  content={(
3818
3818
  <CapSpin
3819
3819
  spinning={isCustomerDataLoading}
@@ -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
- { this.state.translationLang !== 'ja-JP' && (
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
  ),
@@ -137,7 +137,7 @@
137
137
  }
138
138
 
139
139
  &__footer {
140
- padding: $CAP_SPACE_16 0 $CAP_SPACE_08;
140
+ padding: 4.142rem 0 $CAP_SPACE_08;
141
141
  }
142
142
  }
143
143
 
@@ -208,7 +208,7 @@ const CommunicationFlowCard = ({
208
208
  <CapSlideBox
209
209
  show={showSlideBox}
210
210
  handleClose={handleClose}
211
- size="size-xl"
211
+ size="size-l"
212
212
  header={(
213
213
  <CapHeader
214
214
  title={formatMessage(messages.addMessage)}
@@ -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: { message: 'Hello' } }],
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
@@ -2456,7 +2456,7 @@ export class Creatives extends React.Component {
2456
2456
  )}
2457
2457
  handleClose={this.handleCloseSlideBox}
2458
2458
  show={showSlideBox}
2459
- size="size-xl"
2459
+ size="size-l"
2460
2460
  />
2461
2461
  </SlideBoxWrapper>
2462
2462
  );
@@ -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 blob = data.file.slice(0, -1, 'image');
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
  };