@capillarytech/creatives-library 8.0.340-0 → 8.0.340-beta.0.1

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.
Files changed (139) hide show
  1. package/app.js +8 -1
  2. package/global-styles.js +4 -0
  3. package/package.json +2 -2
  4. package/styles/components/navigation/_leftnav.scss +1 -1
  5. package/styles/containers/layout/_layoutPage.scss +1 -1
  6. package/v2Components/AccessForbidden/index.js +1 -1
  7. package/v2Components/CapActionButton/index.js +5 -5
  8. package/v2Components/CapCustomSkeleton/index.js +1 -1
  9. package/v2Components/CapDeviceContent/index.js +5 -5
  10. package/v2Components/CapDocumentUpload/index.js +1 -1
  11. package/v2Components/CapImageUpload/index.js +1 -1
  12. package/v2Components/CapInAppCTA/index.js +118 -112
  13. package/v2Components/CapMpushCTA/index.js +72 -66
  14. package/v2Components/CapTagList/index.js +23 -11
  15. package/v2Components/CapVideoUpload/index.js +1 -1
  16. package/v2Components/CapWhatsappCTA/index.js +128 -124
  17. package/v2Components/CapWhatsappCarouselButton/index.js +27 -29
  18. package/v2Components/CapWhatsappQuickReply/index.js +7 -7
  19. package/v2Components/Carousel/index.js +1 -1
  20. package/v2Components/CommonTestAndPreview/AddTestCustomer.js +1 -1
  21. package/v2Components/CommonTestAndPreview/CustomValuesEditor.js +10 -11
  22. package/v2Components/CommonTestAndPreview/CustomerCreationModal.js +1 -1
  23. package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +4 -4
  24. package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +1 -1
  25. package/v2Components/CommonTestAndPreview/ExistingCustomerModal.js +6 -6
  26. package/v2Components/CommonTestAndPreview/LeftPanelContent.js +5 -5
  27. package/v2Components/CommonTestAndPreview/PreviewSection.js +1 -1
  28. package/v2Components/CommonTestAndPreview/UnifiedPreview/DeviceFrame.js +1 -1
  29. package/v2Components/CommonTestAndPreview/UnifiedPreview/EmailPreviewContent.js +8 -8
  30. package/v2Components/CommonTestAndPreview/UnifiedPreview/InAppPreviewContent.js +14 -13
  31. package/v2Components/CommonTestAndPreview/UnifiedPreview/MobilePushPreviewContent.js +22 -21
  32. package/v2Components/CommonTestAndPreview/UnifiedPreview/PreviewHeader.js +1 -1
  33. package/v2Components/CommonTestAndPreview/UnifiedPreview/RcsPreviewContent.js +9 -9
  34. package/v2Components/CommonTestAndPreview/UnifiedPreview/SmsPreviewContent.js +13 -11
  35. package/v2Components/CommonTestAndPreview/UnifiedPreview/ViberPreviewContent.js +10 -10
  36. package/v2Components/CommonTestAndPreview/UnifiedPreview/WhatsAppPreviewContent.js +13 -12
  37. package/v2Components/CommonTestAndPreview/UnifiedPreview/ZaloPreviewContent.js +4 -3
  38. package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +17 -8
  39. package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +1 -1
  40. package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +30 -5
  41. package/v2Components/CommonTestAndPreview/index.js +3 -3
  42. package/v2Components/CustomerSearchSection/_customerSearch.scss +2 -1
  43. package/v2Components/CustomerSearchSection/index.js +9 -9
  44. package/v2Components/EmailMobilePreview/index.js +1 -1
  45. package/v2Components/ErrorInfoNote/index.js +13 -11
  46. package/v2Components/ErrorInfoNote/style.scss +1 -1
  47. package/v2Components/FormBuilder/_formBuilder.scss +1 -0
  48. package/v2Components/FormBuilder/index.js +32 -40
  49. package/v2Components/HtmlEditor/HTMLEditor.js +4 -4
  50. package/v2Components/HtmlEditor/_htmlEditor.scss +2 -1
  51. package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +1 -1
  52. package/v2Components/HtmlEditor/components/DeviceToggle/_deviceToggle.scss +2 -2
  53. package/v2Components/HtmlEditor/components/DeviceToggle/index.js +2 -2
  54. package/v2Components/HtmlEditor/components/EditorToolbar/PreviewModeGroup.js +2 -2
  55. package/v2Components/HtmlEditor/components/EditorToolbar/index.js +2 -2
  56. package/v2Components/HtmlEditor/components/InAppPreviewPane/index.js +1 -0
  57. package/v2Components/HtmlEditor/components/PreviewPane/index.js +2 -2
  58. package/v2Components/HtmlEditor/components/SplitContainer/SplitContainer.js +2 -2
  59. package/v2Components/HtmlEditor/components/SplitContainer/_splitContainer.scss +2 -1
  60. package/v2Components/HtmlEditor/components/ValidationPanel/index.js +6 -9
  61. package/v2Components/HtmlEditor/components/ValidationTabs/index.js +2 -2
  62. package/v2Components/NavigationBar/index.js +7 -1
  63. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +3 -4
  64. package/v2Components/TemplatePreview/_templatePreview.scss +5 -3
  65. package/v2Components/TemplatePreview/index.js +11 -9
  66. package/v2Components/TestAndPreviewSlidebox/CustomValuesEditor.js +4 -4
  67. package/v2Components/TestAndPreviewSlidebox/LeftPanelContent.js +5 -5
  68. package/v2Components/TestAndPreviewSlidebox/PreviewSection.js +3 -3
  69. package/v2Components/TestAndPreviewSlidebox/_testAndPreviewSlidebox.scss +4 -2
  70. package/v2Containers/BeePopupEditor/index.js +1 -1
  71. package/v2Containers/CommunicationFlow/CommunicationFlow.js +5 -5
  72. package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/ChannelSelectionStep.js +4 -3
  73. package/v2Containers/CommunicationFlow/steps/CommunicationStrategyStep/CommunicationStrategyStep.js +2 -2
  74. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/DeliverySettingsSection.js +3 -2
  75. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/SenderDetails.js +7 -7
  76. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/SenderDetails.scss +0 -5
  77. package/v2Containers/CommunicationFlow/steps/DynamicControlsStep/DynamicControlsStep.js +2 -2
  78. package/v2Containers/CommunicationFlow/steps/MessageTypeStep/MessageTypeStep.js +2 -2
  79. package/v2Containers/CreativesContainer/SlideBoxFooter.js +1 -1
  80. package/v2Containers/CreativesContainer/index.js +1 -1
  81. package/v2Containers/Ebill/index.js +10 -9
  82. package/v2Containers/Email/index.js +7 -7
  83. package/v2Containers/Email/initialSchema.js +1 -1
  84. package/v2Containers/FTP/index.js +1 -1
  85. package/v2Containers/Facebook/Advertisement/index.js +4 -4
  86. package/v2Containers/Facebook/index.js +2 -2
  87. package/v2Containers/InApp/index.js +21 -16
  88. package/v2Containers/InApp/index.scss +0 -7
  89. package/v2Containers/InAppWrapper/components/InAppWrapperView.js +2 -2
  90. package/v2Containers/InappAdvance/index.js +4 -4
  91. package/v2Containers/LanguageProvider/index.js +3 -3
  92. package/v2Containers/LanguageProvider/tests/index.test.js +3 -3
  93. package/v2Containers/Line/Container/Image/index.js +1 -1
  94. package/v2Containers/Line/Container/ImageCarousel/Content.js +1 -1
  95. package/v2Containers/Line/Container/ImageCarousel/index.js +5 -5
  96. package/v2Containers/Line/Container/ImageMap/index.js +3 -3
  97. package/v2Containers/Line/Container/Sticker/index.js +2 -2
  98. package/v2Containers/Line/Container/Sticker/utils.js +1 -1
  99. package/v2Containers/Line/Container/Video/index.js +1 -1
  100. package/v2Containers/Line/Container/Wrapper/index.js +3 -3
  101. package/v2Containers/Line/Container/Wrapper/style.js +1 -5
  102. package/v2Containers/Line/Container/index.js +2 -2
  103. package/v2Containers/Login/components/LoginForm/index.js +34 -47
  104. package/v2Containers/Login/index.js +5 -5
  105. package/v2Containers/MobilePushNew/components/CtaButtons.js +2 -2
  106. package/v2Containers/MobilePushNew/components/MediaUploaders.js +9 -9
  107. package/v2Containers/MobilePushNew/components/PlatformContentFields.js +4 -4
  108. package/v2Containers/MobilePushNew/index.js +2 -2
  109. package/v2Containers/MobilePushNew/index.scss +9 -6
  110. package/v2Containers/Rcs/index.js +24 -19
  111. package/v2Containers/Rcs/index.scss +0 -7
  112. package/v2Containers/Sms/Create/_smsCreate.scss +9 -2
  113. package/v2Containers/Sms/SCHEMA_FORMBUILDER_MAP.md +922 -0
  114. package/v2Containers/Sms/initialSchema.js +7 -1
  115. package/v2Containers/SmsTrai/Edit/index.js +3 -2
  116. package/v2Containers/Templates/index.js +16 -16
  117. package/v2Containers/Viber/constants.js +0 -8
  118. package/v2Containers/Viber/index.js +19 -19
  119. package/v2Containers/Viber/index.scss +0 -7
  120. package/v2Containers/Viber/reducer.js +21 -44
  121. package/v2Containers/Viber/sagas.js +21 -62
  122. package/v2Containers/Viber/tests/index.test.js +0 -80
  123. package/v2Containers/Viber/tests/saga.test.js +40 -365
  124. package/v2Containers/WeChat/RichmediaTemplates/Create/_createRichmedia.scss +1 -1
  125. package/v2Containers/WeChat/RichmediaTemplates/Create/index.js +2 -2
  126. package/v2Containers/WebPush/Create/components/BrandIconSection.js +1 -1
  127. package/v2Containers/WebPush/Create/components/ButtonForm.js +2 -2
  128. package/v2Containers/WebPush/Create/components/ButtonList.js +4 -4
  129. package/v2Containers/WebPush/Create/components/ButtonsLinksSection.js +4 -4
  130. package/v2Containers/WebPush/Create/components/FormActions.js +3 -3
  131. package/v2Containers/WebPush/Create/components/MessageSection.js +2 -2
  132. package/v2Containers/WebPush/Create/components/NotificationTitleSection.js +2 -2
  133. package/v2Containers/WebPush/Create/components/_buttons.scss +2 -2
  134. package/v2Containers/WebPush/Create/index.scss +6 -3
  135. package/v2Containers/WebPush/Create/preview/WebPushPreview.js +1 -1
  136. package/v2Containers/Whatsapp/index.js +28 -28
  137. package/v2Containers/Zalo/index.js +3 -3
  138. package/.npmrc copy +0 -2
  139. package/v2Containers/Viber/tests/reducer.test.js +0 -297
@@ -1,258 +1,50 @@
1
1
  import { expectSaga } from 'redux-saga-test-plan';
2
- import * as matchers from 'redux-saga-test-plan/matchers';
3
- import { call } from 'redux-saga/effects';
2
+ import { call, put } from 'redux-saga/effects';
4
3
  import { throwError } from 'redux-saga-test-plan/providers';
5
4
  import * as Api from '../../../services/api';
6
5
  import * as sagas from '../sagas';
6
+ import { v2ViberSagas } from '../sagas';
7
7
  import * as types from '../constants';
8
- import { pollAssetStatus } from '../../../sagas/assetPolling';
9
- import { ASSET_STATUS } from '../../../utils/assetStatusConstants';
10
8
 
11
9
  describe('Viber Sagas', () => {
10
+
12
11
  describe('uploadViberAsset Saga', () => {
13
- const mockAsset = {
14
- _id: 'asset-123',
15
- type: 'IMAGE',
16
- url: 'https://example.com/image.jpg',
17
- };
12
+ const file = new Blob(['file contents'], { type: 'text/plain' });
13
+ const assetType = 'image';
14
+ const fileParams = { directory: 'profile', templateType: 'viber' };
18
15
 
19
- const mockParams = {
20
- file: new File(['test'], 'test.jpg', { type: 'image/jpeg' }),
21
- assetType: 'image',
22
- fileParams: {},
23
- templateType: 0,
24
- };
25
-
26
- it('handles async upload (202) with polling', () => {
27
- const mockResponse = {
28
- status: { code: 202 },
29
- response: {
30
- assetId: 'asset-123',
31
- asset: mockAsset,
32
- processingStatus: ASSET_STATUS.PROCESSING,
33
- },
34
- };
35
-
36
- return expectSaga(sagas.uploadViberAsset, mockParams)
37
- .provide([
38
- [matchers.call.fn(Api.uploadFile), mockResponse],
39
- [matchers.call.fn(pollAssetStatus), undefined],
40
- ])
41
- .put({
42
- type: types.UPLOAD_VIBER_ASSET_PROCESSING,
43
- payload: {
44
- assetId: 'asset-123',
45
- asset: mockAsset,
46
- processingStatus: ASSET_STATUS.PROCESSING,
47
- },
48
- })
49
- .call.fn(Api.uploadFile)
50
- .call.fn(pollAssetStatus)
51
- .run();
52
- });
53
-
54
- it('handles async when processingStatus is processing with 200 status', () => {
55
- const mockResponse = {
56
- status: { code: 200 },
57
- response: {
58
- assetId: 'asset-123',
59
- asset: mockAsset,
60
- processingStatus: ASSET_STATUS.PROCESSING,
61
- },
62
- };
63
-
64
- return expectSaga(sagas.uploadViberAsset, mockParams)
65
- .provide([
66
- [matchers.call.fn(Api.uploadFile), mockResponse],
67
- [matchers.call.fn(pollAssetStatus), undefined],
68
- ])
69
- .put({
70
- type: types.UPLOAD_VIBER_ASSET_PROCESSING,
71
- payload: {
72
- assetId: 'asset-123',
73
- asset: mockAsset,
74
- processingStatus: ASSET_STATUS.PROCESSING,
75
- },
76
- })
77
- .call.fn(pollAssetStatus)
78
- .run();
79
- });
80
-
81
- it('handles sync upload (201) without polling', () => {
82
- const mockResponse = {
83
- status: { code: 201 },
84
- response: {
85
- asset: mockAsset,
86
- },
16
+ it('handles uploading asset successfully', () => {
17
+ const fakeResponse = {
18
+ response: { asset: { id: 1, url: 'http://example.com/image.png' } },
19
+ status: { code: 200 }
87
20
  };
88
21
 
89
- return expectSaga(sagas.uploadViberAsset, mockParams)
22
+ return expectSaga(sagas.uploadViberAsset, file, assetType, fileParams)
90
23
  .provide([
91
- [matchers.call.fn(Api.uploadFile), mockResponse],
24
+ [call(Api.uploadFile, file, assetType, fileParams), fakeResponse]
92
25
  ])
93
26
  .put({
94
27
  type: types.UPLOAD_VIBER_ASSET_SUCCESS,
95
- data: mockAsset,
96
- statusCode: 201,
97
- templateType: 0,
98
- })
99
- .not.call(pollAssetStatus)
100
- .run();
101
- });
102
-
103
- it('extracts assetId from asset._id when assetId omitted', () => {
104
- const mockResponse = {
105
- status: { code: 202 },
106
- response: {
107
- asset: { ...mockAsset, _id: 'asset-456' },
108
- processingStatus: ASSET_STATUS.PROCESSING,
109
- },
110
- };
111
-
112
- return expectSaga(sagas.uploadViberAsset, mockParams)
113
- .provide([
114
- [matchers.call.fn(Api.uploadFile), mockResponse],
115
- [matchers.call.fn(pollAssetStatus), undefined],
116
- ])
117
- .put({
118
- type: types.UPLOAD_VIBER_ASSET_PROCESSING,
119
- payload: {
120
- assetId: 'asset-456',
121
- asset: { ...mockAsset, _id: 'asset-456' },
122
- processingStatus: ASSET_STATUS.PROCESSING,
123
- },
124
- })
125
- .run();
126
- });
127
-
128
- it('dispatches FAILED when assetId missing on async response', () => {
129
- const mockResponse = {
130
- status: { code: 202 },
131
- response: {
132
- processingStatus: ASSET_STATUS.PROCESSING,
133
- },
134
- };
135
-
136
- return expectSaga(sagas.uploadViberAsset, mockParams)
137
- .provide([
138
- [matchers.call.fn(Api.uploadFile), mockResponse],
139
- ])
140
- .put({
141
- type: types.UPLOAD_VIBER_ASSET_FAILED,
142
- payload: {
143
- assetId: undefined,
144
- error: 'Asset upload initiated but no asset ID was returned from the server. Unable to track processing status.',
145
- },
146
- templateType: 0,
28
+ data: fakeResponse.response.asset,
29
+ statusCode: fakeResponse.status.code,
30
+ templateType: undefined
147
31
  })
148
- .not.call(pollAssetStatus)
149
32
  .run();
150
33
  });
151
34
 
152
- it('handles upload error', () => {
153
- const uploadError = new Error('Upload failed');
35
+ it('handles asset upload failure', () => {
36
+ const error = new Error('Upload failed');
154
37
 
155
- return expectSaga(sagas.uploadViberAsset, mockParams)
38
+ return expectSaga(sagas.uploadViberAsset, file, assetType, fileParams)
156
39
  .provide([
157
- [matchers.call.fn(Api.uploadFile), throwError(uploadError)],
40
+ [call(Api.uploadFile, file, assetType, fileParams), throwError(error)]
158
41
  ])
159
42
  .put({
160
43
  type: types.UPLOAD_VIBER_ASSET_FAILURE,
161
- error: uploadError,
162
- })
163
- .run();
164
- });
165
-
166
- it('falls back to statusCode on response when status object missing', () => {
167
- const mockResponse = {
168
- statusCode: 201,
169
- response: { asset: mockAsset },
170
- };
171
- return expectSaga(sagas.uploadViberAsset, mockParams)
172
- .provide([
173
- [matchers.call.fn(Api.uploadFile), mockResponse],
174
- ])
175
- .put({
176
- type: types.UPLOAD_VIBER_ASSET_SUCCESS,
177
- data: mockAsset,
178
- statusCode: 201,
179
- templateType: 0,
44
+ error
180
45
  })
181
46
  .run();
182
47
  });
183
-
184
- it('defaults statusCode to 200 when no status info present', () => {
185
- const mockResponse = { response: { asset: mockAsset } };
186
- return expectSaga(sagas.uploadViberAsset, mockParams)
187
- .provide([
188
- [matchers.call.fn(Api.uploadFile), mockResponse],
189
- ])
190
- .put({
191
- type: types.UPLOAD_VIBER_ASSET_SUCCESS,
192
- data: mockAsset,
193
- statusCode: 200,
194
- templateType: 0,
195
- })
196
- .run();
197
- });
198
-
199
- it('handles empty response object', () => {
200
- const mockResponse = { status: { code: 201 } };
201
- return expectSaga(sagas.uploadViberAsset, mockParams)
202
- .provide([
203
- [matchers.call.fn(Api.uploadFile), mockResponse],
204
- ])
205
- .put({
206
- type: types.UPLOAD_VIBER_ASSET_SUCCESS,
207
- data: undefined,
208
- statusCode: 201,
209
- templateType: 0,
210
- })
211
- .run();
212
- });
213
-
214
- it('derives assetType from asset.type when params.assetType omitted', () => {
215
- const paramsWithoutType = {
216
- file: new File(['v'], 'v.mp4', { type: 'video/mp4' }),
217
- fileParams: {},
218
- templateType: 1,
219
- };
220
- const mockResponse = {
221
- status: { code: 202 },
222
- response: {
223
- assetId: 'asset-vid',
224
- asset: { _id: 'asset-vid', type: 'VIDEO' },
225
- },
226
- };
227
- return expectSaga(sagas.uploadViberAsset, paramsWithoutType)
228
- .provide([
229
- [matchers.call.fn(Api.uploadFile), mockResponse],
230
- [matchers.call.fn(pollAssetStatus), undefined],
231
- ])
232
- .call.fn(pollAssetStatus)
233
- .run();
234
- });
235
-
236
- it('defaults assetType to image when no type info available', () => {
237
- const paramsWithoutType = {
238
- file: new File(['x'], 'x', { type: '' }),
239
- fileParams: {},
240
- templateType: 0,
241
- };
242
- const mockResponse = {
243
- status: { code: 202 },
244
- response: {
245
- assetId: 'asset-noop',
246
- },
247
- };
248
- return expectSaga(sagas.uploadViberAsset, paramsWithoutType)
249
- .provide([
250
- [matchers.call.fn(Api.uploadFile), mockResponse],
251
- [matchers.call.fn(pollAssetStatus), undefined],
252
- ])
253
- .call.fn(pollAssetStatus)
254
- .run();
255
- });
256
48
  });
257
49
 
258
50
  describe('createViberTemplate Saga', () => {
@@ -262,18 +54,18 @@ describe('Viber Sagas', () => {
262
54
  it('handles creating template successfully', () => {
263
55
  const fakeResponse = {
264
56
  response: { id: 2, content: template.content },
265
- status: { code: 201 },
57
+ status: { code: 201 }
266
58
  };
267
59
 
268
60
  return expectSaga(sagas.createViberTemplate, { template, callback })
269
61
  .provide([
270
- [call(Api.createViberTemplate, { template }), fakeResponse],
62
+ [call(Api.createViberTemplate, { template }), fakeResponse]
271
63
  ])
272
64
  .put({
273
65
  type: types.CREATE_VIBER_TEMPLATE_SUCCESS,
274
66
  data: fakeResponse.response,
275
67
  statusCode: fakeResponse.status.code,
276
- errorMsg: undefined,
68
+ errorMsg: undefined
277
69
  })
278
70
  .run()
279
71
  .then(() => {
@@ -284,74 +76,21 @@ describe('Viber Sagas', () => {
284
76
  it('handles failure in creating template', () => {
285
77
  const error = new Error({ message: 'Creation failed', status: { code: 400 } });
286
78
 
79
+ const errorMsg = 'Creation failed';
287
80
  return expectSaga(sagas.createViberTemplate, { template, callback })
288
81
  .provide([
289
- [call(Api.createViberTemplate, { template }), throwError(error)],
82
+ [call(Api.createViberTemplate, { template }), throwError(error)]
290
83
  ])
291
84
  .put({
292
85
  type: types.CREATE_VIBER_TEMPLATE_FAILURE,
293
86
  error,
294
- errorMsg: undefined,
87
+ errorMsg : undefined
295
88
  })
296
89
  .run()
297
90
  .then(() => {
298
91
  expect(callback).toHaveBeenCalledWith(null, undefined);
299
92
  });
300
93
  });
301
-
302
- it('handles 4xx API response (treated as failure)', () => {
303
- const cb = jest.fn();
304
- const fakeResponse = {
305
- response: {},
306
- status: { code: 400 },
307
- message: 'bad request',
308
- };
309
- return expectSaga(sagas.createViberTemplate, { template, callback: cb })
310
- .provide([
311
- [call(Api.createViberTemplate, { template }), fakeResponse],
312
- ])
313
- .put({
314
- type: types.CREATE_VIBER_TEMPLATE_FAILURE,
315
- error: 'bad request',
316
- errorMsg: 'bad request',
317
- })
318
- .run()
319
- .then(() => {
320
- expect(cb).toHaveBeenCalledWith(null, 'bad request');
321
- });
322
- });
323
-
324
- it('handles success when no callback is supplied', () => {
325
- const fakeResponse = {
326
- response: { id: 42 },
327
- status: { code: 201 },
328
- };
329
- return expectSaga(sagas.createViberTemplate, { template })
330
- .provide([
331
- [call(Api.createViberTemplate, { template }), fakeResponse],
332
- ])
333
- .put({
334
- type: types.CREATE_VIBER_TEMPLATE_SUCCESS,
335
- data: fakeResponse.response,
336
- statusCode: 201,
337
- errorMsg: undefined,
338
- })
339
- .run();
340
- });
341
-
342
- it('handles failure when no callback is supplied', () => {
343
- const error = new Error('Creation failed');
344
- return expectSaga(sagas.createViberTemplate, { template })
345
- .provide([
346
- [call(Api.createViberTemplate, { template }), throwError(error)],
347
- ])
348
- .put({
349
- type: types.CREATE_VIBER_TEMPLATE_FAILURE,
350
- error,
351
- errorMsg: undefined,
352
- })
353
- .run();
354
- });
355
94
  });
356
95
 
357
96
  describe('editTemplate Saga', () => {
@@ -361,18 +100,18 @@ describe('Viber Sagas', () => {
361
100
  it('handles editing template successfully', () => {
362
101
  const fakeResponse = {
363
102
  response: { updated: true },
364
- status: { code: 200 },
103
+ status: { code: 200 }
365
104
  };
366
105
 
367
106
  return expectSaga(sagas.editTemplate, { template, callback })
368
107
  .provide([
369
- [call(Api.createViberTemplate, { template }), fakeResponse],
108
+ [call(Api.createViberTemplate, { template }), fakeResponse]
370
109
  ])
371
110
  .put({
372
111
  type: types.EDIT_VIBER_TEMPLATE_SUCCESS,
373
112
  data: fakeResponse.response,
374
113
  statusCode: fakeResponse.status.code,
375
- errorMsg: undefined,
114
+ errorMsg: undefined
376
115
  })
377
116
  .run()
378
117
  .then(() => {
@@ -384,7 +123,7 @@ describe('Viber Sagas', () => {
384
123
  const errorMsg = 'Error in editing template';
385
124
  return expectSaga(sagas.editTemplate, { template, callback })
386
125
  .provide([
387
- [call(Api.createViberTemplate, { template }), throwError({ message: errorMsg, status: { code: 400 } })],
126
+ [call(Api.createViberTemplate, { template }), throwError({ message: errorMsg, status: { code: 400 } })]
388
127
  ])
389
128
  .put({
390
129
  type: types.EDIT_VIBER_TEMPLATE_FAILURE,
@@ -396,60 +135,6 @@ describe('Viber Sagas', () => {
396
135
  expect(callback).toHaveBeenCalledWith(null, undefined);
397
136
  });
398
137
  });
399
-
400
- it('handles 4xx API response (treated as failure)', () => {
401
- const cb = jest.fn();
402
- const fakeResponse = {
403
- response: {},
404
- status: { code: 422 },
405
- message: 'invalid payload',
406
- };
407
- return expectSaga(sagas.editTemplate, { template, callback: cb })
408
- .provide([
409
- [call(Api.createViberTemplate, { template }), fakeResponse],
410
- ])
411
- .put({
412
- type: types.EDIT_VIBER_TEMPLATE_FAILURE,
413
- error: 'invalid payload',
414
- errorMsg: 'invalid payload',
415
- })
416
- .run()
417
- .then(() => {
418
- expect(cb).toHaveBeenCalledWith(null, 'invalid payload');
419
- });
420
- });
421
-
422
- it('handles success when no callback is supplied', () => {
423
- const fakeResponse = {
424
- response: { updated: true },
425
- status: { code: 200 },
426
- };
427
- return expectSaga(sagas.editTemplate, { template })
428
- .provide([
429
- [call(Api.createViberTemplate, { template }), fakeResponse],
430
- ])
431
- .put({
432
- type: types.EDIT_VIBER_TEMPLATE_SUCCESS,
433
- data: fakeResponse.response,
434
- statusCode: 200,
435
- errorMsg: undefined,
436
- })
437
- .run();
438
- });
439
-
440
- it('handles failure when no callback is supplied', () => {
441
- const error = new Error('Edit failed');
442
- return expectSaga(sagas.editTemplate, { template })
443
- .provide([
444
- [call(Api.createViberTemplate, { template }), throwError(error)],
445
- ])
446
- .put({
447
- type: types.EDIT_VIBER_TEMPLATE_FAILURE,
448
- error,
449
- errorMsg: undefined,
450
- })
451
- .run();
452
- });
453
138
  });
454
139
 
455
140
  describe('getTemplateDetails Saga', () => {
@@ -458,16 +143,16 @@ describe('Viber Sagas', () => {
458
143
 
459
144
  it('handles fetching template details successfully', () => {
460
145
  const fakeResponse = {
461
- response: { id, name: 'Detailed Template' },
146
+ response: { id: id, name: 'Detailed Template' }
462
147
  };
463
148
 
464
149
  return expectSaga(sagas.getTemplateDetails, { id, callback })
465
150
  .provide([
466
- [call(Api.getTemplateDetails, { id, channel: 'VIBER' }), fakeResponse],
151
+ [call(Api.getTemplateDetails, { id, channel: 'VIBER' }), fakeResponse]
467
152
  ])
468
153
  .put({
469
154
  type: types.GET_VIBER_TEMPLATE_DETAILS_SUCCESS,
470
- data: fakeResponse.response,
155
+ data: fakeResponse.response
471
156
  })
472
157
  .run()
473
158
  .then(() => {
@@ -480,33 +165,23 @@ describe('Viber Sagas', () => {
480
165
 
481
166
  return expectSaga(sagas.getTemplateDetails, { id, callback })
482
167
  .provide([
483
- [call(Api.getTemplateDetails, { id, channel: 'VIBER' }), throwError(error)],
168
+ [call(Api.getTemplateDetails, { id, channel: 'VIBER' }), throwError(error)]
484
169
  ])
485
170
  .put({
486
171
  type: types.GET_VIBER_TEMPLATE_DETAILS_FAILURE,
487
- error,
172
+ error
488
173
  })
489
174
  .run()
490
175
  .then(() => {
491
176
  expect(callback).not.toHaveBeenCalledWith();
492
177
  });
493
178
  });
494
-
495
- it('handles success without a callback', () => {
496
- const fakeResponse = { response: { id, name: 'No CB' } };
497
- return expectSaga(sagas.getTemplateDetails, { id })
498
- .provide([
499
- [call(Api.getTemplateDetails, { id, channel: 'VIBER' }), fakeResponse],
500
- ])
501
- .put({
502
- type: types.GET_VIBER_TEMPLATE_DETAILS_SUCCESS,
503
- data: fakeResponse.response,
504
- })
505
- .run();
506
- });
507
179
  });
508
180
 
509
181
  describe('v2ViberSagas Combined', () => {
510
- it('should initialize all Viber-related watcher sagas without error', () => expectSaga(sagas.v2ViberSagas).run());
182
+ it('should initialize all Viber-related watcher sagas without error', () => {
183
+ return expectSaga(v2ViberSagas).run();
184
+ });
511
185
  });
512
- });
186
+
187
+ });
@@ -147,7 +147,7 @@
147
147
  }
148
148
  .embedded-mode {
149
149
  .cover-image-row {
150
- display: none;
150
+ display: none !important;
151
151
  }
152
152
  }
153
153
  }
@@ -500,12 +500,12 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
500
500
  if (id === 0) {
501
501
  returnObj.push(
502
502
  <div style={{ width: "100%", height: 116, position: "relative" }}>
503
- <CapRow>
503
+ <CapRow useLegacy>
504
504
  <img alt="default" width="100%" height="110px" src={contentData.imageUrl} />
505
505
  <div style={{ position: "absolute", bottom: "5%", left: "5%" }}>{contentData.formData['title-value'] ? contentData.formData['title-value'] : ""}</div>
506
506
  </CapRow>
507
507
  {Object.keys(templateData).length === 1 ?
508
- <CapRow style={{ height: 32 }}>
508
+ <CapRow useLegacy style={{ height: 32 }}>
509
509
  {contentData.formData['cover-abstract-value'] ? contentData.formData['cover-abstract-value'] : ""}
510
510
  </CapRow>
511
511
  :
@@ -56,7 +56,7 @@ export const BrandIconSection = ({
56
56
  />
57
57
  </CapRow>
58
58
  {brandIconOption === BRAND_ICON_OPTIONS.UPLOAD_IMAGE && (
59
- <CapRow
59
+ <CapRow useLegacy
60
60
  className="webpush-brand-icon-upload-section"
61
61
  style={isLocked ? { pointerEvents: 'none', opacity: 0.5 } : undefined}
62
62
  aria-disabled={isLocked}
@@ -98,7 +98,7 @@ const ButtonForm = ({
98
98
 
99
99
  return (
100
100
  <div className="webpush-button-form" onKeyDown={handleKeyDown}>
101
- <CapRow className="button-form-row">
101
+ <CapRow useLegacy className="button-form-row">
102
102
  <CapHeading type="h4" className="button-form-heading">
103
103
  <FormattedMessage {...messages.buttonText} />
104
104
  </CapHeading>
@@ -116,7 +116,7 @@ const ButtonForm = ({
116
116
  />
117
117
  </div>
118
118
  </CapRow>
119
- <CapRow className="button-form-row">
119
+ <CapRow useLegacy className="button-form-row">
120
120
  <CapHeading type="h4" className="button-form-heading">
121
121
  <FormattedMessage {...messages.buttonUrlLabel} />
122
122
  </CapHeading>
@@ -83,9 +83,9 @@ const ButtonList = ({
83
83
  );
84
84
  })}
85
85
  {showAddPrimary && (
86
- <CapRow className="button-list-add-button">
86
+ <CapRow useLegacy className="button-list-add-button">
87
87
  <CapButton
88
- type="flat"
88
+ type="link"
89
89
  onClick={onAddPrimary}
90
90
  className="add-primary-button button-add-trigger"
91
91
  icon="plus"
@@ -96,9 +96,9 @@ const ButtonList = ({
96
96
  </CapRow>
97
97
  )}
98
98
  {showAddSecondary && (
99
- <CapRow className="button-list-add-button">
99
+ <CapRow useLegacy className="button-list-add-button">
100
100
  <CapButton
101
- type="flat"
101
+ type="link"
102
102
  onClick={onAddSecondary}
103
103
  className="add-secondary-button button-add-trigger"
104
104
  icon="plus"
@@ -82,7 +82,7 @@ export const ButtonsLinksSection = ({
82
82
  />
83
83
  )}
84
84
  </CapRow>
85
- <CapRow className="creatives-webpush-buttons-section">
85
+ <CapRow useLegacy className="creatives-webpush-buttons-section">
86
86
  <CapHeading type="h5" className="webpush-buttons-section-heading">
87
87
  <FormattedMessage {...messages.buttons} />{' '}
88
88
  <span className="optional-text">
@@ -109,7 +109,7 @@ export const ButtonsLinksSection = ({
109
109
  <div className="button-add-controls">
110
110
  {showAddPrimaryButton && (
111
111
  <CapButton
112
- type="flat"
112
+ type="link"
113
113
  onClick={handleAddPrimaryButton}
114
114
  className="add-primary-button button-add-trigger"
115
115
  icon="plus"
@@ -119,7 +119,7 @@ export const ButtonsLinksSection = ({
119
119
  )}
120
120
  {showAddSecondaryButton && (
121
121
  <CapButton
122
- type="flat"
122
+ type="link"
123
123
  onClick={handleAddSecondaryButton}
124
124
  className="add-secondary-button button-add-trigger"
125
125
  icon="plus"
@@ -129,7 +129,7 @@ export const ButtonsLinksSection = ({
129
129
  )}
130
130
  {showDisabledSecondaryDuringPrimary && (
131
131
  <CapButton
132
- type="flat"
132
+ type="link"
133
133
  className="add-secondary-button button-add-trigger"
134
134
  icon="plus"
135
135
  disabled
@@ -16,18 +16,18 @@ export const FormActions = ({
16
16
  messages,
17
17
  }) => (
18
18
  <>
19
- <CapRow className="creatives-webpush-actions">
19
+ <CapRow useLegacy className="creatives-webpush-actions">
20
20
  <CapButton type="primary" onClick={onSave} disabled={isSaveDisabled}>
21
21
  {formatMessage(messages.saveTemplate)}
22
22
  </CapButton>
23
23
  </CapRow>
24
24
  {errorText && (
25
- <CapRow>
25
+ <CapRow useLegacy>
26
26
  <CapError className="webpush-template-error">{errorText}</CapError>
27
27
  </CapRow>
28
28
  )}
29
29
  {accountErrorText && (
30
- <CapRow>
30
+ <CapRow useLegacy>
31
31
  <CapError className="webpush-template-account-error">
32
32
  {accountErrorText}
33
33
  </CapError>
@@ -92,8 +92,8 @@ export const MessageSection = ({
92
92
 
93
93
  return (
94
94
  <>
95
- <CapRow className="creatives-webpush-message">
96
- <CapRow className="tooltip-add-label-container webpush-message-taglist">
95
+ <CapRow useLegacy className="creatives-webpush-message">
96
+ <CapRow useLegacy className="tooltip-add-label-container webpush-message-taglist">
97
97
  {tagList}
98
98
  </CapRow>
99
99
  <CapHeading type="h4" className="webpush-message">