@capillarytech/creatives-library 9.0.55-alpha.2 → 9.0.55-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.55-alpha.2",
4
+ "version": "9.0.55-alpha.3",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -137,7 +137,7 @@
137
137
  }
138
138
 
139
139
  &__footer {
140
- padding: 4.142rem 0 $CAP_SPACE_08;
140
+ padding: 3.142rem 0 $CAP_SPACE_08;
141
141
  }
142
142
  }
143
143
 
@@ -111,6 +111,11 @@ const CommunicationFlowCard = ({
111
111
  const senderIdValue = getSenderIdValue(firstItem, savedData);
112
112
  const controls = config?.features?.dynamicControlsData?.controls || DYNAMIC_CONTROLS_CONFIG;
113
113
  const dynamicControlKeys = Object.keys(savedData?.dynamicControls || {});
114
+ // Mirrors getEnabledSteps.js's own gate on this flag (which skips the in-slidebox
115
+ // DynamicControlsStep) — consumers like CapNotify that set showDynamicControls:
116
+ // false render their own "Advanced controls" section elsewhere, so this summary
117
+ // card's right column would otherwise show a redundant, always-empty control list.
118
+ const showDynamicControls = config?.features?.showDynamicControls !== false;
114
119
  const channel = firstItem.channel?.toUpperCase();
115
120
  const senderLabel = [WHATSAPP, RCS].includes(channel)
116
121
  ? formatMessage(messages.senderNumberLabel)
@@ -124,7 +129,11 @@ const CommunicationFlowCard = ({
124
129
  <CapLabel type="label8">Message:</CapLabel>
125
130
  <CapLabel type="label2">{strategyLabel}</CapLabel>
126
131
  {messageTypeLabel && (
127
- <CapLabel type="label1">({messageTypeLabel})</CapLabel>
132
+ <CapLabel type="label1">
133
+ (
134
+ {messageTypeLabel}
135
+ )
136
+ </CapLabel>
128
137
  )}
129
138
  </CapRow>
130
139
  )}
@@ -139,33 +148,41 @@ const CommunicationFlowCard = ({
139
148
  bodyStyle={{ padding: 0 }}
140
149
  >
141
150
  <CapRow gutter={0} className="card-body-row">
142
- <CapColumn span={12} className="card-body-left-col">
151
+ <CapColumn span={showDynamicControls ? 12 : 24} className="card-body-left-col">
143
152
  <CapRow type="flex" align="middle" className="channel-header-row">
144
153
  <CapIcon type={channelConfig?.iconType || 'sms'} size="s" />
145
154
  <CapLabel type="label8">{channelConfig?.label || firstItem.channel}</CapLabel>
146
155
  {senderIdValue && (
147
- <CapLabel type="label1">({senderLabel}: {senderIdValue})</CapLabel>
156
+ <CapLabel type="label1">
157
+ (
158
+ {senderLabel}
159
+ :
160
+ {senderIdValue}
161
+ )
162
+ </CapLabel>
148
163
  )}
149
164
  </CapRow>
150
165
  {getContentBody(firstItem)}
151
166
  </CapColumn>
152
- <CapColumn span={12} className="card-body-right-col">
153
- <CapLabel type="label8">{formatMessage(messages.dynamicControlsTitle)}</CapLabel>
154
- {dynamicControlKeys.map((key) => {
155
- const controlConfig = controls.find((c) => c.key === key);
156
- if (!controlConfig) return null;
157
- return (
158
- <CapRow key={key} type="flex" justify="space-between" className="control-row">
159
- <CapLabel type="label2">{controlConfig.label}</CapLabel>
160
- <CapLabel type="label2">
161
- {savedData.dynamicControls[key]
162
- ? formatMessage(messages.yes)
163
- : formatMessage(messages.no)}
164
- </CapLabel>
165
- </CapRow>
166
- );
167
- })}
168
- </CapColumn>
167
+ {showDynamicControls && (
168
+ <CapColumn span={12} className="card-body-right-col">
169
+ <CapLabel type="label8">{formatMessage(messages.dynamicControlsTitle)}</CapLabel>
170
+ {dynamicControlKeys.map((key) => {
171
+ const controlConfig = controls.find((c) => c.key === key);
172
+ if (!controlConfig) return null;
173
+ return (
174
+ <CapRow key={key} type="flex" justify="space-between" className="control-row">
175
+ <CapLabel type="label2">{controlConfig.label}</CapLabel>
176
+ <CapLabel type="label2">
177
+ {savedData.dynamicControls[key]
178
+ ? formatMessage(messages.yes)
179
+ : formatMessage(messages.no)}
180
+ </CapLabel>
181
+ </CapRow>
182
+ );
183
+ })}
184
+ </CapColumn>
185
+ )}
169
186
  </CapRow>
170
187
  </CapCard>
171
188
  );
@@ -211,7 +228,7 @@ const CommunicationFlowCard = ({
211
228
  size="size-l"
212
229
  header={(
213
230
  <CapHeader
214
- title={formatMessage(messages.addMessage)}
231
+ title={formatMessage(messages.addContent)}
215
232
  handleClose={handleClose}
216
233
  />
217
234
  )}
@@ -1000,3 +1000,22 @@ describe('optional chaining safety', () => {
1000
1000
  expect(screen.getByRole('button', { name: /^save$/i })).toBeDisabled();
1001
1001
  });
1002
1002
  });
1003
+
1004
+ describe('step dividers', () => {
1005
+ it('renders exactly one divider when the strategy and channel-selection steps render together', () => {
1006
+ const { container } = renderWithFlow({
1007
+ features: {
1008
+ communicationStrategyData: { required: true, options: STRATEGY_OPTIONS },
1009
+ contentTemplateData: { required: true, channels: CHANNELS },
1010
+ },
1011
+ initialData: {
1012
+ communicationStrategy: SINGLE_TEMPLATE,
1013
+ contentItems: [{ channel: 'SMS', templateData: {} }],
1014
+ },
1015
+ });
1016
+ // Only ChannelSelectionStep's own divider (after the content-preview card) should
1017
+ // render — CommunicationStrategyStep no longer emits one of its own, otherwise two
1018
+ // dividers would stack back-to-back with nothing between them.
1019
+ expect(container.querySelectorAll('.ant-divider')).toHaveLength(1);
1020
+ });
1021
+ });
@@ -202,6 +202,26 @@ describe('CommunicationFlowCard', () => {
202
202
  renderCard({ initialData: makeSavedData() });
203
203
  expect(screen.getByText('Other controls')).toBeInTheDocument();
204
204
  });
205
+
206
+ it('hides the Other controls column when config.features.showDynamicControls is false', () => {
207
+ renderCard({
208
+ config: { ...baseConfig, features: { showDynamicControls: false } },
209
+ initialData: makeSavedData({
210
+ dynamicControls: {
211
+ sendToControlCustomers: false, sendToBrandPocs: false, useTinyUrl: false, overrideDailyLimit: false,
212
+ },
213
+ }),
214
+ });
215
+ expect(screen.queryByText('Other controls')).not.toBeInTheDocument();
216
+ });
217
+
218
+ it('still shows the Other controls column when showDynamicControls is unset (Engagement Module default)', () => {
219
+ renderCard({
220
+ config: { ...baseConfig, features: {} },
221
+ initialData: makeSavedData(),
222
+ });
223
+ expect(screen.getByText('Other controls')).toBeInTheDocument();
224
+ });
205
225
  });
206
226
 
207
227
  describe('channel config resolution', () => {
@@ -64,9 +64,9 @@ export default {
64
64
  },
65
65
 
66
66
  // Slidebox header
67
- addMessage: {
68
- id: `${prefix}.addMessage`,
69
- defaultMessage: 'Add message',
67
+ addContent: {
68
+ id: `${prefix}.addContent`,
69
+ defaultMessage: 'Add content',
70
70
  },
71
71
 
72
72
  // Step prompts
@@ -407,10 +407,6 @@ const ChannelSelectionStep = ({
407
407
  return (
408
408
  <>
409
409
  <CapRow className="channel-selection-step">
410
- <CapHeading type="h3" className="margin-b-8">
411
- {formatMessage(messages.contentTemplate)}
412
- </CapHeading>
413
-
414
410
  <CapRow
415
411
  useLegacy
416
412
  className={`content-template-container ${contentItems?.length > 0 ? 'content-template-container--has-content' : ''}`}