@capillarytech/creatives-library 9.0.53-alpha.1 → 9.0.53-alpha.3

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.53-alpha.1",
4
+ "version": "9.0.53-alpha.3",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -231,7 +231,7 @@ const CommunicationFlow = ({
231
231
  ccsCommDefinition = {
232
232
  id: data.id,
233
233
  referenceId: data.referenceId,
234
- version: data.version?.version || 1,
234
+ version: data.version?.version ?? 1,
235
235
  status: data.status,
236
236
  };
237
237
  }
@@ -240,6 +240,10 @@ const CommunicationFlow = ({
240
240
  }
241
241
  } else if (!name) {
242
242
  console.warn('[CommunicationFlow] Skipping CCS createCommDefinition — config.context.name is required');
243
+ } else if (isMultiChannel) {
244
+ console.warn('[CommunicationFlow] Skipping CCS createCommDefinition — CHANNEL_PRIORITY/AB_TEST strategies are not supported by CCS create yet (SINGLE only)');
245
+ } else if (!contentItem) {
246
+ console.warn('[CommunicationFlow] Skipping CCS createCommDefinition — no content item found (contentItems is empty)');
243
247
  }
244
248
  }
245
249
 
@@ -444,6 +444,28 @@ describe('handleSave — CCS flow', () => {
444
444
  );
445
445
  });
446
446
 
447
+ it('preserves a real version of 0 from CCS (not coerced to 1 by a falsy-zero fallback)', async () => {
448
+ const onSave = jest.fn();
449
+ createCommDefinition.mockResolvedValueOnce({
450
+ response: { data: { id: 'cd_123', referenceId: 'ORDER_PLACED_123', status: 'DRAFT', version: { version: 0 } } },
451
+ });
452
+ renderWithFlow({
453
+ features: {},
454
+ config: ccsConfig,
455
+ initialData: { contentItems: [{ channel: 'SMS', templateData: {} }] },
456
+ onSave,
457
+ });
458
+
459
+ await userEvent.click(screen.getByRole('button', { name: /^save$/i }));
460
+
461
+ await waitFor(() => expect(onSave).toHaveBeenCalledTimes(1));
462
+ expect(onSave).toHaveBeenCalledWith(
463
+ expect.objectContaining({
464
+ ccsCommDefinition: { id: 'cd_123', referenceId: 'ORDER_PLACED_123', version: 0, status: 'DRAFT' },
465
+ }),
466
+ );
467
+ });
468
+
447
469
  it('generates a referenceId from name when config.context.referenceId is absent', async () => {
448
470
  // moduleMocks.js spies on Date.now globally, but this config's resetMocks:true
449
471
  // clears that return value before every test — set it explicitly here.