@capillarytech/creatives-library 7.13.15 → 7.13.16
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/tests/api.test.js +1 -6
- package/utils/cdnTransformation.js +2 -0
- package/utils/tests/cdnTransformation.mockdata.js +0 -37
- package/utils/tests/cdnTransformation.test.js +2 -66
- package/v2Components/FormBuilder/index.js +0 -1
- package/v2Components/TemplatePreview/index.js +1 -2
- package/v2Containers/CapFacebookPreview/index.js +0 -1
- package/v2Containers/CapFacebookPreview/tests/index.test.js +40 -0
- package/v2Containers/CapFacebookPreview/tests/mockdata.js +60 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +0 -4
- package/v2Containers/CreativesContainer/index.js +0 -1
- package/v2Containers/MobilePush/Create/index.js +0 -1
- package/v2Containers/MobilePush/Edit/index.js +0 -1
- package/v2Containers/MobilepushWrapper/index.js +0 -1
- package/v2Containers/Templates/sagas.js +3 -2
- package/v2Containers/TemplatesV2/index.js +0 -1
- package/v2Containers/Templates/tests/mockData.js +0 -30
- package/v2Containers/Templates/tests/sagas.test.js +0 -76
package/package.json
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import { getSenderDetails, uploadFile
|
|
1
|
+
import { getSenderDetails, uploadFile } from "../api";
|
|
2
2
|
|
|
3
3
|
describe("getSenderDetails -- Test with valid responses", () => {
|
|
4
4
|
it("Should return correct response", () =>
|
|
5
5
|
expect(getSenderDetails("WHATSAPP", -1)).toEqual(Promise.resolve()));
|
|
6
6
|
});
|
|
7
7
|
|
|
8
|
-
describe("getCdnTransformationConfigs -- Test with valid responses", () => {
|
|
9
|
-
it("Should return correct response", () =>
|
|
10
|
-
expect(getCdnTransformationConfig()).toEqual(Promise.resolve()));
|
|
11
|
-
});
|
|
12
|
-
|
|
13
8
|
describe("uploadFile -- whatsapp image upload", () => {
|
|
14
9
|
it("Should return correct response", () =>
|
|
15
10
|
expect(
|
|
@@ -299,40 +299,3 @@ export const emailTemplateRaw = {
|
|
|
299
299
|
"type": "EMAIL",
|
|
300
300
|
"name": "test template1"
|
|
301
301
|
}
|
|
302
|
-
|
|
303
|
-
export const emailTemplateRawWithError = {
|
|
304
|
-
"versions": {
|
|
305
|
-
"base": {
|
|
306
|
-
"activeTab": "en",
|
|
307
|
-
"selectedLanguages": [
|
|
308
|
-
"en"
|
|
309
|
-
],
|
|
310
|
-
"base": true,
|
|
311
|
-
"tabKey": "6",
|
|
312
|
-
"subject": "hello subject"
|
|
313
|
-
},
|
|
314
|
-
"history": [
|
|
315
|
-
{
|
|
316
|
-
"activeTab": "en",
|
|
317
|
-
"en": {
|
|
318
|
-
"is_drag_drop": false,
|
|
319
|
-
"lang_id": 69,
|
|
320
|
-
"iso_code": "en",
|
|
321
|
-
"language": "English",
|
|
322
|
-
"template-content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional //EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:v=\"urn:schemas-microsoft-com:vml\">\n<head><!--[if gte mso 9]><xml><o:OfficeDocumentSettings><o:AllowPNG/><o:PixelsPerInch>96</o:PixelsPerInch></o:OfficeDocumentSettings></xml><![endif]--><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"><meta name=\"viewport\" content=\"width=device-width\"><!--[if !mso]><meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"><!--<![endif]-->\n\t<title></title>\n\t<!--[if !mso]><!--<![endif]-->\n\t<style type=\"text/css\">body {\n margin: 0;\n padding: 0; }\n\ntable,\ntd,\ntr {\n vertical-align: top;\n border-collapse: collapse; }\n\n* {\n line-height: inherit; }\n\na[x-apple-data-detectors=true] {\n color: inherit !important;\n text-decoration: none !important; }\n\t</style>\n\t<style id=\"media-query\" type=\"text/css\">@media (max-width: 520px) {\n .block-grid,\n.col {\n min-width: 320px !important;\n max-width: 100% !important;\n display: block !important;\n }\n\n .block-grid {\n width: 100% !important;\n }\n\n .col {\n width: 100% !important;\n }\n\n .col > div {\n margin: 0 auto;\n }\n\n img.fullwidth,\nimg.fullwidthOnMobile {\n max-width: 100% !important;\n }\n\n .no-stack .col {\n min-width: 0 !important;\n display: table-cell !important;\n }\n\n .no-stack.two-up .col {\n width: 50% !important;\n }\n\n .no-stack .col.num4 {\n width: 33% !important;\n }\n\n .no-stack .col.num8 {\n width: 66% !important;\n }\n\n .no-stack .col.num4 {\n width: 33% !important;\n }\n\n .no-stack .col.num3 {\n width: 25% !important;\n }\n\n .no-stack .col.num6 {\n width: 50% !important;\n }\n\n .no-stack .col.num9 {\n width: 75% !important;\n }\n\n .video-block {\n max-width: none !important;\n }\n\n .mobile_hide {\n min-height: 0px;\n max-height: 0px;\n max-width: 0px;\n display: none;\n overflow: hidden;\n font-size: 0px;\n }\n\n .desktop_hide {\n display: block !important;\n max-height: none !important;\n }\n}\n\t</style>\n</head>\n<body class=\"clean-body\" style=\"margin: 0; padding: 0; -webkit-text-size-adjust: 100%; background-color: #FFFFFF;\">\n<p><!--[if IE]><div class=\"ie-browser\"><![endif]-->hello world</p>\n\n<p><img alt=\"Capillary Image\" height=\"171\" src=\"https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/b4b63b22-8a81-41ee-a8df-6db967fc.jpg\" width=\"257\" /></p>\n\n<table bgcolor=\"#FFFFFF\" cellpadding=\"0\" cellspacing=\"0\" class=\"nl-container\" role=\"presentation\" style=\"background-color:#ffffff; border-collapse:collapse; border-spacing:0; margin:0 auto; min-width:320px; mso-table-lspace:0pt; mso-table-rspace:0pt; table-layout:fixed; vertical-align:top; width:100%\" valign=\"top\">\n\t<tbody>\n\t\t<tr style=\"vertical-align:top\" valign=\"top\">\n\t\t\t<td style=\"vertical-align:top; word-break:break-word\"><!--[if (mso)|(IE)]><table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td align=\"center\" style=\"background-color:#FFFFFF\"><![endif]-->\n\t\t\t<div style=\"background-color:transparent\">\n\t\t\t<div class=\"block-grid\" style=\"background-color:transparent; margin-bottom:0; margin-left:auto; margin-right:auto; margin-top:0; max-width:500px; min-width:320px; overflow-wrap:break-word; word-break:break-word; word-wrap:break-word\">\n\t\t\t<div style=\"background-color:transparent; border-collapse:collapse; display:table; width:100%\"><!--[if (mso)|(IE)]><table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"background-color:transparent;\"><tr><td align=\"center\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"width:500px\"><tr class=\"layout-full-width\" style=\"background-color:transparent\"><![endif]--><!--[if (mso)|(IE)]><td align=\"center\" width=\"500\" style=\"background-color:transparent;width:500px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;\" valign=\"top\"><table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td style=\"padding-right: 0px; padding-left: 0px; padding-top:5px; padding-bottom:5px;\"><![endif]-->\n\t\t\t<div class=\"col num12\" style=\"display:table-cell; max-width:500px; min-width:320px; vertical-align:top; width:500px\">\n\t\t\t<div style=\"width:100% !important\"><!--[if (!mso)&(!IE)]><div style=\"border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:5px; padding-bottom:5px; padding-right: 0px; padding-left: 0px;\"><!--<![endif]--><!--[if (!mso)&(!IE)]></div><!--<![endif]--></div>\n\t\t\t</div>\n\t\t\t<!--[if (mso)|(IE)]></td></tr></table><![endif]--><!--[if (mso)|(IE)]></td></tr></table></td></tr></table><![endif]--></div>\n\t\t\t</div>\n\t\t\t</div>\n\t\t\t<!--[if (mso)|(IE)]></td></tr></table><![endif]--></td>\n\t\t</tr>\n\t</tbody>\n</table>\n<!--[if (IE)]></div><![endif]--></body>\n</html>\n",
|
|
323
|
-
"drag_drop_id": "",
|
|
324
|
-
"tabKey": "6",
|
|
325
|
-
"id": "5f7b61605f09ebe595ff404e"
|
|
326
|
-
},
|
|
327
|
-
"selectedLanguages": [
|
|
328
|
-
"en"
|
|
329
|
-
],
|
|
330
|
-
"base": true,
|
|
331
|
-
"tabKey": "6",
|
|
332
|
-
"subject": "hello subject"
|
|
333
|
-
}
|
|
334
|
-
]
|
|
335
|
-
},
|
|
336
|
-
"type": "EMAIL",
|
|
337
|
-
"name": "test template1"
|
|
338
|
-
}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import * as cdnUtils from "../cdnTransformation";
|
|
2
2
|
import * as mockdata from "./cdnTransformation.mockdata";
|
|
3
|
-
import * as nodeHtmlParser from 'node-html-parser'
|
|
4
|
-
import Bugsnag from '@bugsnag/js';
|
|
5
3
|
|
|
6
|
-
var bugsnagSpy;
|
|
7
|
-
var localStorageMock;
|
|
8
4
|
beforeEach(() => {
|
|
9
|
-
localStorageMock = (function () {
|
|
5
|
+
var localStorageMock = (function () {
|
|
10
6
|
var store = {
|
|
11
7
|
CREATIVES_CDN_TRANSFORMATION_URL_SUFFIX: "cdn-cgi/image",
|
|
12
8
|
CREATIVES_S3_BUCKET_PATH: "intouch_creative_assets",
|
|
@@ -29,8 +25,7 @@ beforeEach(() => {
|
|
|
29
25
|
},
|
|
30
26
|
};
|
|
31
27
|
})();
|
|
32
|
-
Object.defineProperty(window, "localStorage", { value: localStorageMock
|
|
33
|
-
bugsnagSpy = jest.spyOn(Bugsnag, 'notify');
|
|
28
|
+
Object.defineProperty(window, "localStorage", { value: localStorageMock });
|
|
34
29
|
});
|
|
35
30
|
|
|
36
31
|
afterEach(() => {
|
|
@@ -41,8 +36,6 @@ afterEach(() => {
|
|
|
41
36
|
localStorage.setItem(
|
|
42
37
|
"CREATIVES_S3_BUCKET_PATH", "intouch_creative_assets"
|
|
43
38
|
);
|
|
44
|
-
jest.restoreAllMocks();
|
|
45
|
-
jest.resetAllMocks();
|
|
46
39
|
});
|
|
47
40
|
|
|
48
41
|
describe("cdnTransformationTests", () => {
|
|
@@ -219,14 +212,6 @@ describe("cdnTransformationTests", () => {
|
|
|
219
212
|
expect(cdnUtils.updateImagesInHtml(null)).toEqual(null);
|
|
220
213
|
expect(cdnUtils.updateImagesInHtml("")).toEqual("");
|
|
221
214
|
});
|
|
222
|
-
|
|
223
|
-
it("should call bugsnag when parse() throws some unexpected error.", () => {
|
|
224
|
-
const spy = jest.spyOn(nodeHtmlParser, 'parse').mockImplementation(()=>{
|
|
225
|
-
throw new Error();
|
|
226
|
-
})
|
|
227
|
-
expect(cdnUtils.updateImagesInHtml(mockdata.emailRawInput)).toEqual(mockdata.emailRawInput);
|
|
228
|
-
expect(bugsnagSpy).toHaveBeenCalled();
|
|
229
|
-
});
|
|
230
215
|
});
|
|
231
216
|
|
|
232
217
|
describe("transformEmailTemplate()", () => {
|
|
@@ -236,13 +221,6 @@ describe("cdnTransformationTests", () => {
|
|
|
236
221
|
cdnUtils.transformEmailTemplates(emailTemplateInput);
|
|
237
222
|
expect(emailTemplateOutput).toMatchSnapshot();
|
|
238
223
|
});
|
|
239
|
-
it("should return original contents transform email template throws an error inside. This might be due to improper input or unexpected error.", () => {
|
|
240
|
-
const emailTemplateInputWithError = mockdata.emailTemplateRawWithError;
|
|
241
|
-
const emailTemplateOutput =
|
|
242
|
-
cdnUtils.transformEmailTemplates(emailTemplateInputWithError);
|
|
243
|
-
expect(emailTemplateInputWithError).toEqual(emailTemplateOutput);
|
|
244
|
-
expect(bugsnagSpy).toHaveBeenCalled();
|
|
245
|
-
});
|
|
246
224
|
});
|
|
247
225
|
|
|
248
226
|
describe("saveCdnConfigs()", () => {
|
|
@@ -260,7 +238,6 @@ describe("cdnTransformationTests", () => {
|
|
|
260
238
|
LINE: 75,
|
|
261
239
|
DEFAULT: 75,
|
|
262
240
|
},
|
|
263
|
-
bucketPath: 'intouch_creative_assets'
|
|
264
241
|
};
|
|
265
242
|
|
|
266
243
|
const expected = {
|
|
@@ -268,7 +245,6 @@ describe("cdnTransformationTests", () => {
|
|
|
268
245
|
CREATIVES_CDN_BASE_URL: "https://storage.crm.n.content-cdn.io",
|
|
269
246
|
CREATIVES_CDN_QUALITY_CONFIG:
|
|
270
247
|
'{"EMAIL":75,"RCS":75,"VIBER":75,"WHATSAPP":75,"MOBILE_PUSH":75,"FACEBOOK":75,"LINE":75,"DEFAULT":75}',
|
|
271
|
-
CREATIVES_S3_BUCKET_PATH: 'intouch_creative_assets',
|
|
272
248
|
};
|
|
273
249
|
cdnUtils.saveCdnConfigs(cdnConfigs);
|
|
274
250
|
|
|
@@ -281,19 +257,6 @@ describe("cdnTransformationTests", () => {
|
|
|
281
257
|
expect(localStorage.getItem("CREATIVES_CDN_QUALITY_CONFIG")).toBe(
|
|
282
258
|
expected.CREATIVES_CDN_QUALITY_CONFIG
|
|
283
259
|
);
|
|
284
|
-
expect(localStorage.getItem("CREATIVES_S3_BUCKET_PATH")).toBe(
|
|
285
|
-
expected.CREATIVES_S3_BUCKET_PATH
|
|
286
|
-
);
|
|
287
|
-
});
|
|
288
|
-
|
|
289
|
-
it("should clear items from localStorage if qualityConfigs is not present", () => {
|
|
290
|
-
const cdnConfigs = {
|
|
291
|
-
bucketPath: "intouch_creative_assets",
|
|
292
|
-
};
|
|
293
|
-
cdnUtils.saveCdnConfigs(cdnConfigs);
|
|
294
|
-
expect(localStorage.getItem("CREATIVES_CDN_QUALITY_CONFIG")).toBe(
|
|
295
|
-
undefined
|
|
296
|
-
);
|
|
297
260
|
});
|
|
298
261
|
|
|
299
262
|
it("should clear items from localStorage if input does not contain hostname or transformationUrlSuffix", () => {
|
|
@@ -338,32 +301,5 @@ describe("cdnTransformationTests", () => {
|
|
|
338
301
|
expect(localStorage.getItem("CREATIVES_CDN_BASE_URL")).toBe(undefined);
|
|
339
302
|
expect(localStorage.getItem("CREATIVES_CDN_QUALITY_CONFIG")).toBe(undefined);
|
|
340
303
|
});
|
|
341
|
-
|
|
342
|
-
it("should call bugsnag notify if any unexpected error occured during removeAllCdnLocalStorageItems", () => {
|
|
343
|
-
delete window.localStorage.removeItem;
|
|
344
|
-
|
|
345
|
-
cdnUtils.removeAllCdnLocalStorageItems('CREATIVES_CDN_BASE_URL');
|
|
346
|
-
|
|
347
|
-
expect(bugsnagSpy).toHaveBeenCalled();
|
|
348
|
-
});
|
|
349
|
-
|
|
350
|
-
it("should call bugsnag notify if any unexpected error occured during saveCdnConfigs", () => {
|
|
351
|
-
delete window?.localStorage?.setItem; //this is a case used to mimick any unexpected error
|
|
352
|
-
|
|
353
|
-
const cdnConfigs = {
|
|
354
|
-
transformationUrlSuffix: "cdn-cgi/image",
|
|
355
|
-
hostname: "https://storage.crm.n.content-cdn.io",
|
|
356
|
-
qualityCfg: {
|
|
357
|
-
DEFAULT: 75,
|
|
358
|
-
},
|
|
359
|
-
bucketPath: 'intouch_creative_assets'
|
|
360
|
-
};
|
|
361
|
-
|
|
362
|
-
cdnUtils.saveCdnConfigs(cdnConfigs);
|
|
363
|
-
|
|
364
|
-
expect(bugsnagSpy).toHaveBeenCalled();
|
|
365
|
-
|
|
366
|
-
window.localStorage.setItem = ()=>{};
|
|
367
|
-
});
|
|
368
304
|
});
|
|
369
305
|
});
|
|
@@ -3092,7 +3092,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3092
3092
|
onTestContentClicked={this.props.onTestContentClicked}
|
|
3093
3093
|
templateDataRaw={this.props.templateData}
|
|
3094
3094
|
module={this.props.location.query.module}
|
|
3095
|
-
hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
|
|
3096
3095
|
>
|
|
3097
3096
|
</TemplatePreview>
|
|
3098
3097
|
</CapColumn>
|
|
@@ -160,7 +160,6 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
160
160
|
intl,
|
|
161
161
|
templateData,
|
|
162
162
|
rcsIosPreview,
|
|
163
|
-
hideTestAndPreviewBtn
|
|
164
163
|
} = this.props;
|
|
165
164
|
const { formatMessage } = intl;
|
|
166
165
|
const { buttonText, imageURL, rcsPreviewContent, messageContent: viberMessageContent } = content || {};
|
|
@@ -194,7 +193,7 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
194
193
|
const disablePreviewAndTest = this.props.channel === 'MOBILEPUSH' ? !this.props.content.header : (this.props.channel === 'SMS' ? !this.props.content : false);
|
|
195
194
|
const showTestAndPreview = showTestAndPreviewIcon &&
|
|
196
195
|
channel !== WECHAT &&
|
|
197
|
-
['outbound', 'library'].includes(module)
|
|
196
|
+
['outbound', 'library'].includes(module);
|
|
198
197
|
|
|
199
198
|
const renderLineMultiText = (content) => {
|
|
200
199
|
let textCount = 0;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { injectIntl } from 'react-intl';
|
|
3
|
+
import '@testing-library/jest-dom';
|
|
4
|
+
import userEvent from '@testing-library/user-event';
|
|
5
|
+
import {render, screen, fireEvent } from '../../../utils/test-utils';
|
|
6
|
+
import {CapFacebookPreview} from '../index';
|
|
7
|
+
import { facebookImgMockData, getPreviewActionCalledWith } from './mockdata';
|
|
8
|
+
|
|
9
|
+
const ComponentToRender = injectIntl(CapFacebookPreview);
|
|
10
|
+
const renderComponent = props => render(<ComponentToRender {...props} />);
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
const getPreview = jest.fn();
|
|
14
|
+
const clearPreview = jest.fn();
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
describe("CapFacebookPreview Test",()=>{
|
|
18
|
+
it("It should call getPreview action with appropriate fields", ()=>{
|
|
19
|
+
const facebookPreviewActions = {
|
|
20
|
+
getPreview,
|
|
21
|
+
clearPreview
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const props = {
|
|
25
|
+
...facebookImgMockData,
|
|
26
|
+
facebookPreviewActions
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
renderComponent(props);
|
|
31
|
+
|
|
32
|
+
const generatePreviewBtn = screen.getByRole('button', { name: /generate preview/i});
|
|
33
|
+
expect(generatePreviewBtn).toBeEnabled();
|
|
34
|
+
|
|
35
|
+
fireEvent.click(generatePreviewBtn);
|
|
36
|
+
|
|
37
|
+
expect(getPreview).toHaveBeenCalledTimes(1);
|
|
38
|
+
expect(getPreview).toHaveBeenCalledWith(getPreviewActionCalledWith);
|
|
39
|
+
})
|
|
40
|
+
})
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export const facebookImgMockData = {
|
|
2
|
+
"disablePreviewButton": false,
|
|
3
|
+
"selectedAd": "IMAGE",
|
|
4
|
+
"previewData": [
|
|
5
|
+
{
|
|
6
|
+
"subType": "IMAGE",
|
|
7
|
+
"imageData": {
|
|
8
|
+
"imageSrc": "https://storage.crm.n.content-cdn.io/cdn-cgi/image/quality=75/intouch_creative_assets/e94dbe9b-b3a1-4eec-86d0-d859d7a.jpeg"
|
|
9
|
+
},
|
|
10
|
+
"videoData": {},
|
|
11
|
+
"webSiteLink": "https://www.google.com",
|
|
12
|
+
"linkHeadLine": "asdf",
|
|
13
|
+
"linkDesc": "asdfa",
|
|
14
|
+
"errorMsg": {
|
|
15
|
+
"websiteLinkErrorMsg": false
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"primaryText": "af",
|
|
20
|
+
"callToAction": "NO_CALL_TO_ACTION",
|
|
21
|
+
"displayLink": "",
|
|
22
|
+
"orgUnitFacebookPageSettingsMap": {
|
|
23
|
+
"pageId": "1234",
|
|
24
|
+
"pageName": "1234_Nightly",
|
|
25
|
+
"pageAccessToken": "randomPageAccessToken",
|
|
26
|
+
"pageStatus": "SENT",
|
|
27
|
+
"verificationStatus": "APPROVED",
|
|
28
|
+
"isPageAccessTokenUpdated": false
|
|
29
|
+
},
|
|
30
|
+
"accessToken": "randomAccessToken",
|
|
31
|
+
"accountId": "1234567",
|
|
32
|
+
"facebookPreviewData": {
|
|
33
|
+
"fetchPreviewStatus": "PreviewNotRequested",
|
|
34
|
+
"previewIframe": "",
|
|
35
|
+
"previewIframeError": ""
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const getPreviewActionCalledWith = {
|
|
40
|
+
accessToken: "randomAccessToken",
|
|
41
|
+
pageAccessToken: "randomPageAccessToken",
|
|
42
|
+
pageId: "1234",
|
|
43
|
+
actId: "act_1234567",
|
|
44
|
+
params: {
|
|
45
|
+
creative: {
|
|
46
|
+
object_story_spec: {
|
|
47
|
+
page_id: "1234",
|
|
48
|
+
link_data: {
|
|
49
|
+
description: "asdfa",
|
|
50
|
+
message: "af",
|
|
51
|
+
link: "https://www.google.com",
|
|
52
|
+
name: "asdf",
|
|
53
|
+
picture:
|
|
54
|
+
"https://storage.crm.n.content-cdn.io/cdn-cgi/image/quality=75/intouch_creative_assets/e94dbe9b-b3a1-4eec-86d0-d859d7a.jpeg",
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
ad_format: "DESKTOP_FEED_STANDARD",
|
|
59
|
+
},
|
|
60
|
+
};
|
|
@@ -147,7 +147,6 @@ export function SlideBoxContent(props) {
|
|
|
147
147
|
orgUnitId,
|
|
148
148
|
smsRegister,
|
|
149
149
|
enableNewChannels,
|
|
150
|
-
hideTestAndPreviewBtn
|
|
151
150
|
} = props;
|
|
152
151
|
const type = (messageDetails.type || '').toLowerCase(); // type is context in get tags values : outbound | dvs | referral | loyalty | coupons
|
|
153
152
|
const query = { type: !isFullMode && 'embedded', module: isFullMode ? 'default' : 'library', isEditFromCampaigns: (templateData || {}).isEditFromCampaigns};
|
|
@@ -408,7 +407,6 @@ export function SlideBoxContent(props) {
|
|
|
408
407
|
orgUnitId={orgUnitId}
|
|
409
408
|
smsRegister={smsRegister}
|
|
410
409
|
enableNewChannels={enableNewChannels}
|
|
411
|
-
hideTestAndPreviewBtn={hideTestAndPreviewBtn}
|
|
412
410
|
/>
|
|
413
411
|
)}
|
|
414
412
|
{isPreview && (
|
|
@@ -604,7 +602,6 @@ export function SlideBoxContent(props) {
|
|
|
604
602
|
onPreviewContentClicked={onPreviewContentClicked}
|
|
605
603
|
onTestContentClicked={onTestContentClicked}
|
|
606
604
|
type={type}
|
|
607
|
-
hideTestAndPreviewBtn={hideTestAndPreviewBtn}
|
|
608
605
|
/>
|
|
609
606
|
}
|
|
610
607
|
{isCreateMPush &&
|
|
@@ -631,7 +628,6 @@ export function SlideBoxContent(props) {
|
|
|
631
628
|
onValidationFail={onValidationFail}
|
|
632
629
|
selectedOfferDetails={selectedOfferDetails}
|
|
633
630
|
onPreviewContentClicked={onPreviewContentClicked}
|
|
634
|
-
hideTestAndPreviewBtn={hideTestAndPreviewBtn}
|
|
635
631
|
onTestContentClicked={onTestContentClicked}/>
|
|
636
632
|
}
|
|
637
633
|
{
|
|
@@ -1107,7 +1107,6 @@ export class Creatives extends React.Component {
|
|
|
1107
1107
|
messageStrategy={this.props.strategy}
|
|
1108
1108
|
orgUnitId={this.props.orgUnitId}
|
|
1109
1109
|
enableNewChannels={enableNewChannels}
|
|
1110
|
-
hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
|
|
1111
1110
|
/>
|
|
1112
1111
|
}
|
|
1113
1112
|
footer={this.shouldShowFooter() &&
|
|
@@ -1737,7 +1737,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1737
1737
|
onPreviewContentClicked={this.props.onPreviewContentClicked}
|
|
1738
1738
|
onTestContentClicked={this.props.onTestContentClicked}
|
|
1739
1739
|
templateData={this.props.templateData}
|
|
1740
|
-
hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
|
|
1741
1740
|
/>
|
|
1742
1741
|
</CapColumn>
|
|
1743
1742
|
{this.props.iosCtasData && this.state.showIosCtaTable &&
|
|
@@ -1821,7 +1821,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1821
1821
|
onPreviewContentClicked={this.props.onPreviewContentClicked}
|
|
1822
1822
|
onTestContentClicked={this.props.onTestContentClicked}
|
|
1823
1823
|
templateData={this.props.templateData}
|
|
1824
|
-
hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
|
|
1825
1824
|
/>}
|
|
1826
1825
|
</CapColumn>
|
|
1827
1826
|
{this.props.iosCtasData && this.state.showIosCtaTable &&
|
|
@@ -115,7 +115,6 @@ export class MobilepushWrapper extends React.Component { // eslint-disable-line
|
|
|
115
115
|
onPreviewContentClicked={onPreviewContentClicked}
|
|
116
116
|
onTestContentClicked={onTestContentClicked}
|
|
117
117
|
templateData={templateData}
|
|
118
|
-
hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
|
|
119
118
|
/>
|
|
120
119
|
|
|
121
120
|
|
|
@@ -86,9 +86,10 @@ export function* getOrgLevelCampaignSettings() {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
function* getCdnTransformationConfig() {
|
|
90
90
|
try {
|
|
91
91
|
const res = yield call(Api.getCdnTransformationConfig);
|
|
92
|
+
|
|
92
93
|
if (res?.success && res?.status?.code === 200) {
|
|
93
94
|
const cdnConfigs = res?.response;
|
|
94
95
|
saveCdnConfigs(cdnConfigs);
|
|
@@ -238,7 +239,7 @@ function* watchGetSenderDetails() {
|
|
|
238
239
|
yield cancel(watcher);
|
|
239
240
|
}
|
|
240
241
|
|
|
241
|
-
|
|
242
|
+
function* watchGetCdnTransformationConfig() {
|
|
242
243
|
yield takeLatest(
|
|
243
244
|
types.GET_CDN_TRANSFORMATION_CONFIG_REQUEST,
|
|
244
245
|
getCdnTransformationConfig
|
|
@@ -260,7 +260,6 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
260
260
|
handlePeviewTemplate={this.props.handlePeviewTemplate}
|
|
261
261
|
messageStrategy={this.props.messageStrategy}
|
|
262
262
|
smsRegister={smsRegister}
|
|
263
|
-
hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
|
|
264
263
|
/>);
|
|
265
264
|
}
|
|
266
265
|
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export const getCdnTransformationConfigSuccess = {
|
|
2
|
-
"success": true,
|
|
3
|
-
"status": {
|
|
4
|
-
"isError": false,
|
|
5
|
-
"code": 200,
|
|
6
|
-
"message": "success"
|
|
7
|
-
},
|
|
8
|
-
"message": "CDN transformation config fetched",
|
|
9
|
-
"response": {
|
|
10
|
-
"hostname": "https://storage.crm.staging.content-cdn.io",
|
|
11
|
-
"transformationUrlSuffix": "cdn-cgi/image",
|
|
12
|
-
"bucketPath": "intouch_creative_assets",
|
|
13
|
-
"qualityCfg": {
|
|
14
|
-
"EMAIL": 65,
|
|
15
|
-
"RCS": 75,
|
|
16
|
-
"VIBER": 75,
|
|
17
|
-
"WHATSAPP": 75,
|
|
18
|
-
"MOBILE_PUSH": 75,
|
|
19
|
-
"FACEBOOK": 75,
|
|
20
|
-
"LINE": 75,
|
|
21
|
-
"DEFAULT": 75
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const getCdnTransformationConfigFailure = {
|
|
27
|
-
"isError": true,
|
|
28
|
-
"message": "Resource Not Found",
|
|
29
|
-
"error": {}
|
|
30
|
-
};
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { expectSaga } from 'redux-saga-test-plan';
|
|
2
|
-
import { take, call, takeLatest, takeEvery } from 'redux-saga/effects';
|
|
3
|
-
import * as matchers from 'redux-saga-test-plan/matchers';
|
|
4
|
-
import * as api from '../../../services/api';
|
|
5
|
-
import * as types from '../constants';
|
|
6
|
-
import * as cdnUtils from '../../../utils/cdnTransformation';
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
getCdnTransformationConfig,
|
|
10
|
-
watchGetCdnTransformationConfig
|
|
11
|
-
} from '../sagas';
|
|
12
|
-
|
|
13
|
-
import * as mockData from './mockData';
|
|
14
|
-
|
|
15
|
-
describe('getCdnTransformationConfig saga', () => {
|
|
16
|
-
it("handle valid response from api", () => {
|
|
17
|
-
const saveCdnConfigsSpy = jest.spyOn(cdnUtils, "saveCdnConfigs");
|
|
18
|
-
|
|
19
|
-
expectSaga(getCdnTransformationConfig)
|
|
20
|
-
.provide([
|
|
21
|
-
[
|
|
22
|
-
call(api.getCdnTransformationConfig),
|
|
23
|
-
mockData.getCdnTransformationConfigSuccess,
|
|
24
|
-
],
|
|
25
|
-
])
|
|
26
|
-
.run();
|
|
27
|
-
expect(saveCdnConfigsSpy).toHaveBeenCalled();
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it("handle error response from api", () => {
|
|
31
|
-
const removeAllCdnLocalStorageItemsSpy = jest.spyOn(
|
|
32
|
-
cdnUtils,
|
|
33
|
-
"removeAllCdnLocalStorageItems"
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
expectSaga(getCdnTransformationConfig)
|
|
37
|
-
.provide([
|
|
38
|
-
[
|
|
39
|
-
call(api.getCdnTransformationConfig),
|
|
40
|
-
mockData.getCdnTransformationConfigFailure,
|
|
41
|
-
],
|
|
42
|
-
])
|
|
43
|
-
.run();
|
|
44
|
-
expect(removeAllCdnLocalStorageItemsSpy).toHaveBeenCalled();
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it("remove localStorage items when an error is thrown", () => {
|
|
48
|
-
const saveCdnConfigsSpy = jest.spyOn(cdnUtils, "saveCdnConfigs").mockImplementation(()=>{
|
|
49
|
-
throw new Error()
|
|
50
|
-
});
|
|
51
|
-
const removeAllCdnLocalStorageItemsSpy = jest.spyOn(
|
|
52
|
-
cdnUtils,
|
|
53
|
-
"removeAllCdnLocalStorageItems"
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
expectSaga(getCdnTransformationConfig)
|
|
57
|
-
.provide([
|
|
58
|
-
[
|
|
59
|
-
call(api.getCdnTransformationConfig),
|
|
60
|
-
mockData.getCdnTransformationConfigSuccess,
|
|
61
|
-
],
|
|
62
|
-
])
|
|
63
|
-
.run();
|
|
64
|
-
expect(removeAllCdnLocalStorageItemsSpy).toHaveBeenCalled();
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
describe('watchForGetJourneyList saga', () => {
|
|
70
|
-
const generator = watchGetCdnTransformationConfig();
|
|
71
|
-
it('should call watchers functions', () => {
|
|
72
|
-
expect(generator.next().value).toEqual(
|
|
73
|
-
takeLatest(types.GET_CDN_TRANSFORMATION_CONFIG_REQUEST, getCdnTransformationConfig),
|
|
74
|
-
);
|
|
75
|
-
});
|
|
76
|
-
});
|