@capillarytech/creatives-library 9.0.56-alpha.6 → 9.0.56-alpha.8
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/services/api.js +1 -1
- package/utils/templateVarUtils.js +1 -17
- package/v2Components/CapActionButton/index.js +73 -60
- package/v2Components/CapActionButton/index.scss +44 -28
- package/v2Components/CapActionButton/messages.js +7 -3
- package/v2Components/CapActionButton/tests/index.test.js +17 -1
- package/v2Components/CapWhatsappCTA/messages.js +4 -0
- package/v2Components/CapWhatsappCarouselButton/index.js +42 -33
- package/v2Components/CapWhatsappCarouselButton/index.scss +44 -2
- package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +1 -2
- package/v2Components/CommonTestAndPreview/index.js +3 -6
- package/v2Containers/CommunicationFlow/CommunicationFlow.js +12 -0
- package/v2Containers/CommunicationFlow/CommunicationFlow.scss +2 -14
- package/v2Containers/CommunicationFlow/CommunicationFlowCard.js +10 -2
- package/v2Containers/CommunicationFlow/Tests/CommunicationFlow.test.js +35 -3
- package/v2Containers/CommunicationFlow/Tests/CommunicationFlowCard.test.js +58 -0
- package/v2Containers/CommunicationFlow/constants.js +1 -3
- package/v2Containers/CommunicationFlow/messages.js +4 -0
- package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/ChannelSelectionStep.js +5 -1
- package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/Tests/ChannelSelectionStep.test.js +64 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/DeliverySettingsSection.js +19 -4
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/SenderDetails.js +8 -4
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/DeliverySettingsSection.test.js +11 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/SenderDetails.test.js +26 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/deliverySettingsConfig.js +3 -3
- package/v2Containers/CreativesContainer/SlideBoxContent.js +15 -0
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +6 -2
- package/v2Containers/CreativesContainer/index.js +27 -0
- package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +29 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +13 -0
- package/v2Containers/MobilePush/Create/index.js +18 -1
- package/v2Containers/MobilePush/Create/test/contentValidity.test.js +96 -0
- package/v2Containers/MobilePush/Edit/index.js +18 -1
- package/v2Containers/MobilePush/Edit/test/contentValidity.test.js +116 -0
- package/v2Containers/MobilePush/commonMethods.js +49 -1
- package/v2Containers/MobilePushNew/index.js +29 -4
- package/v2Containers/MobilePushNew/tests/index.test.js +119 -0
- package/v2Containers/MobilePushNew/tests/utils.test.js +82 -0
- package/v2Containers/MobilePushNew/utils.js +34 -1
- package/v2Containers/MobilepushWrapper/index.js +3 -1
- package/v2Containers/Rcs/index.js +34 -0
- package/v2Containers/Rcs/index.scss +15 -0
- package/v2Containers/Rcs/tests/index.test.js +67 -0
- package/v2Containers/Sms/Create/index.js +3 -1
- package/v2Containers/Sms/Edit/index.js +25 -0
- package/v2Containers/Sms/Edit/tests/index.test.js +85 -0
- package/v2Containers/Viber/index.js +24 -1
- package/v2Containers/Viber/tests/index.test.js +103 -0
- package/v2Containers/WebPush/Create/index.js +24 -0
- package/v2Containers/WebPush/Create/tests/contentValidity.test.js +294 -0
- package/v2Containers/Whatsapp/index.js +20 -4
- package/v2Containers/Whatsapp/tests/index.test.js +115 -0
- package/v2Containers/Zalo/index.js +28 -1
- package/v2Containers/Zalo/tests/index.test.js +99 -0
|
@@ -150,4 +150,103 @@ describe('Test activity zalo container', () => {
|
|
|
150
150
|
),
|
|
151
151
|
).toBeInTheDocument();
|
|
152
152
|
});
|
|
153
|
+
|
|
154
|
+
// Fully self-contained fixtures for the tests below: the "set template data" test above
|
|
155
|
+
// mutates the shared `editData`/`templateData` fixtures in place (handleSetValues mutates
|
|
156
|
+
// listParam objects directly, and that test also reassigns templateData.templateConfigs),
|
|
157
|
+
// so building independent literals here — rather than reusing or cloning the shared
|
|
158
|
+
// fixtures at test time (which would just clone the already-mutated state) — keeps these
|
|
159
|
+
// tests correct regardless of suite execution order.
|
|
160
|
+
const buildFreshEditData = () => ({
|
|
161
|
+
zaloTemplateInfoStatus: 'success',
|
|
162
|
+
zaloTemplateInfoValue: {
|
|
163
|
+
name: 'Fresh Template',
|
|
164
|
+
versions: {
|
|
165
|
+
base: {
|
|
166
|
+
content: {
|
|
167
|
+
zalo: {
|
|
168
|
+
templateId: '1',
|
|
169
|
+
templateName: 'Fresh Template',
|
|
170
|
+
listParams: [
|
|
171
|
+
{
|
|
172
|
+
name: 'danh_xung',
|
|
173
|
+
require: true,
|
|
174
|
+
type: 'STRING',
|
|
175
|
+
maxLength: 30,
|
|
176
|
+
minLength: 0,
|
|
177
|
+
acceptNull: false,
|
|
178
|
+
error: '',
|
|
179
|
+
value: '',
|
|
180
|
+
},
|
|
181
|
+
],
|
|
182
|
+
previewUrl: 'https://account.zalo.cloud/preview',
|
|
183
|
+
status: 'ENABLE',
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
type: 'ZALO',
|
|
189
|
+
},
|
|
190
|
+
zaloTemplateInfoError: null,
|
|
191
|
+
});
|
|
192
|
+
const buildFreshTemplateData = () => ({
|
|
193
|
+
_id: 999001,
|
|
194
|
+
templateConfigs: { id: '', varMapped: {} },
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
it('reports content emptiness to the parent via onContentValidityChange', async () => {
|
|
198
|
+
const onContentValidityChange = jest.fn();
|
|
199
|
+
renderComponent({
|
|
200
|
+
actions: mockActions,
|
|
201
|
+
globalActions: mockGlobalActions,
|
|
202
|
+
editData: buildFreshEditData(),
|
|
203
|
+
metaEntities,
|
|
204
|
+
location,
|
|
205
|
+
getDefaultTags,
|
|
206
|
+
injectedTags,
|
|
207
|
+
accountData,
|
|
208
|
+
templateData: buildFreshTemplateData(),
|
|
209
|
+
isFullMode: true,
|
|
210
|
+
onContentValidityChange,
|
|
211
|
+
});
|
|
212
|
+
const inputBox = await screen.findAllByPlaceholderText(
|
|
213
|
+
'Add labels or text or combination of both',
|
|
214
|
+
);
|
|
215
|
+
// Initial values in the mock data are blank, so the first report should be "empty".
|
|
216
|
+
expect(onContentValidityChange).toHaveBeenCalledWith({ isContentEmpty: true });
|
|
217
|
+
onContentValidityChange.mockClear();
|
|
218
|
+
|
|
219
|
+
fireEvent.change(inputBox[0], { target: { value: 'Hello, welcome' } });
|
|
220
|
+
expect(onContentValidityChange).toHaveBeenCalledWith({ isContentEmpty: false });
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
it('does not re-report validity when it has not changed (dedup guard)', async () => {
|
|
224
|
+
const onContentValidityChange = jest.fn();
|
|
225
|
+
renderComponent({
|
|
226
|
+
actions: mockActions,
|
|
227
|
+
globalActions: mockGlobalActions,
|
|
228
|
+
editData: buildFreshEditData(),
|
|
229
|
+
metaEntities,
|
|
230
|
+
location,
|
|
231
|
+
getDefaultTags,
|
|
232
|
+
injectedTags,
|
|
233
|
+
accountData,
|
|
234
|
+
templateData: buildFreshTemplateData(),
|
|
235
|
+
isFullMode: true,
|
|
236
|
+
onContentValidityChange,
|
|
237
|
+
});
|
|
238
|
+
const inputBox = await screen.findAllByPlaceholderText(
|
|
239
|
+
'Add labels or text or combination of both',
|
|
240
|
+
);
|
|
241
|
+
onContentValidityChange.mockClear();
|
|
242
|
+
|
|
243
|
+
fireEvent.change(inputBox[0], { target: { value: 'Hello' } });
|
|
244
|
+
expect(onContentValidityChange).toHaveBeenCalledTimes(1);
|
|
245
|
+
expect(onContentValidityChange).toHaveBeenCalledWith({ isContentEmpty: false });
|
|
246
|
+
onContentValidityChange.mockClear();
|
|
247
|
+
|
|
248
|
+
// Changing to another non-empty value keeps isContentEmpty === false, so no new report.
|
|
249
|
+
fireEvent.change(inputBox[0], { target: { value: 'Hello again' } });
|
|
250
|
+
expect(onContentValidityChange).not.toHaveBeenCalled();
|
|
251
|
+
});
|
|
153
252
|
});
|