@capillarytech/creatives-library 7.12.67 → 7.12.69

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 (30) hide show
  1. package/config/app.js +1 -0
  2. package/package.json +1 -1
  3. package/services/tests/api.test.js +26 -0
  4. package/v2Components/CapWhatsappCTA/index.js +7 -8
  5. package/v2Components/CapWhatsappCTA/index.scss +2 -1
  6. package/v2Components/CapWhatsappCTA/messages.js +6 -2
  7. package/v2Components/CapWhatsappCTA/tests/index.test.js +11 -8
  8. package/v2Components/TemplatePreview/tests/__snapshots__/index.test.js.snap +13 -6
  9. package/v2Components/TemplatePreview/tests/index.test.js +5 -3
  10. package/v2Components/WhatsappStatusContainer/tests/__snapshots__/index.test.js.snap +55 -2
  11. package/v2Components/WhatsappStatusContainer/tests/index.test.js +8 -4
  12. package/v2Components/mockdata.js +94 -37
  13. package/v2Containers/CreativesContainer/SlideBoxHeader.js +4 -3
  14. package/v2Containers/CreativesContainer/index.scss +15 -0
  15. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +27 -25
  16. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +19 -4
  17. package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +76 -3
  18. package/v2Containers/CreativesContainer/tests/index.test.js +26 -12
  19. package/v2Containers/Templates/_templates.scss +20 -0
  20. package/v2Containers/Templates/index.js +15 -5
  21. package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +39 -265
  22. package/v2Containers/Templates/tests/index.test.js +35 -25
  23. package/v2Containers/Whatsapp/index.js +9 -7
  24. package/v2Containers/Whatsapp/index.scss +1 -0
  25. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +60140 -4887
  26. package/v2Containers/Whatsapp/tests/__snapshots__/utils.test.js.snap +28 -21
  27. package/v2Containers/Whatsapp/tests/index.test.js +18 -4
  28. package/v2Containers/Whatsapp/tests/mockData.js +15 -1
  29. package/v2Containers/Whatsapp/tests/utils.test.js +11 -5
  30. package/v2Containers/mockdata.js +262 -227
@@ -2,7 +2,7 @@
2
2
 
3
3
  exports[`Test utils test getWhatsappContent 1`] = `
4
4
  Object {
5
- "charCount": 46,
5
+ "charCount": 151,
6
6
  "ctaData": Array [
7
7
  Object {
8
8
  "index": 0,
@@ -12,42 +12,46 @@ Object {
12
12
  },
13
13
  Object {
14
14
  "index": 1,
15
- "text": "More info",
16
- "type": "STATIC_URL",
17
- "url": "https://fast.com/",
15
+ "text": "Visit",
16
+ "type": "DYNAMIC_URL",
17
+ "url": "https://docs.google.com/{{1}}",
18
18
  },
19
19
  ],
20
20
  "templateMsg": <CapLabel
21
21
  type="label9"
22
22
  >
23
- 1234567890
23
+ Hey {{1}}, Easier implementation, tracking, reporting and planning of promotions is now live! Check it out at {{2}}
24
24
  Click {{unsubscribe}} to unsubscribe
25
25
  </CapLabel>,
26
+ "whatsappImageSrc": "https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/c9edc114-923b-4ac7-82d0-d6682213.jpg",
26
27
  }
27
28
  `;
28
29
 
29
30
  exports[`Test utils test getWhatsappContent 2`] = `
30
31
  Object {
31
- "charCount": 3,
32
- "ctaData": Array [
33
- Object {
34
- "index": 0,
35
- "phone_number": "",
36
- "text": "",
37
- "type": "PHONE_NUMBER",
38
- },
39
- ],
32
+ "charCount": 36,
40
33
  "templateMsg": <CapLabel
41
34
  type="label9"
42
35
  >
43
- test
36
+ Hi {{1}}, your payment is successful.
37
+ </CapLabel>,
38
+ }
39
+ `;
40
+
41
+ exports[`Test utils test getWhatsappContent 3`] = `
42
+ Object {
43
+ "charCount": -1,
44
+ "templateMsg": <CapLabel
45
+ type="label9"
46
+ >
47
+
44
48
  </CapLabel>,
45
49
  }
46
50
  `;
47
51
 
48
52
  exports[`Test utils test getWhatsappContent for preview 1`] = `
49
53
  Object {
50
- "charCount": 46,
54
+ "charCount": 151,
51
55
  "ctaData": Array [
52
56
  Object {
53
57
  "index": 0,
@@ -57,17 +61,18 @@ Object {
57
61
  },
58
62
  Object {
59
63
  "index": 1,
60
- "text": "More info",
61
- "type": "STATIC_URL",
62
- "url": "https://fast.com/",
64
+ "text": "Visit",
65
+ "type": "DYNAMIC_URL",
66
+ "url": "https://docs.google.com/{{1}}",
63
67
  },
64
68
  ],
65
69
  "templateMsg": <CapLabel
66
70
  type="label5"
67
71
  >
68
- 1234567890
72
+ Hey {{1}}, Easier implementation, tracking, reporting and planning of promotions is now live! Check it out at {{2}}
69
73
  Click {{unsubscribe}} to unsubscribe
70
74
  </CapLabel>,
75
+ "whatsappImageSrc": "https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/c9edc114-923b-4ac7-82d0-d6682213.jpg",
71
76
  }
72
77
  `;
73
78
 
@@ -115,9 +120,11 @@ Array [
115
120
  }
116
121
  type="launch"
117
122
  />
118
- More info
123
+ Visit
119
124
  </CapLabel>,
120
125
  ]
121
126
  `;
122
127
 
123
128
  exports[`Test utils test getWhatsappCta 2`] = `Array []`;
129
+
130
+ exports[`Test utils test getWhatsappCta 3`] = `Array []`;
@@ -28,9 +28,11 @@ describe('Creatives Whatsapp test1/>', () => {
28
28
  id: mockData.editData1.templateDetails._id,
29
29
  };
30
30
  const { editData1, editData2, editData3, editdata4, editdata5 } = mockData;
31
- const accountData = mockData.accountData;
31
+ const accountData1 = mockData.accountData1;
32
+ const accountData2 = mockData.accountData2;
33
+ const accountData3 = mockData.accountData3;
32
34
 
33
- const renderHelper = (args, isFullMode = true) => {
35
+ const renderHelper = (args, isFullMode = true, accData = accountData1) => {
34
36
  renderedComponent = mountWithIntl(
35
37
  <Provider store={store}>
36
38
  <Whatsapp
@@ -47,7 +49,7 @@ describe('Creatives Whatsapp test1/>', () => {
47
49
  params={args.params}
48
50
  editData={args.editData}
49
51
  templateData={args.templateData}
50
- accountData={accountData}
52
+ accountData={accData}
51
53
  location={location}
52
54
  intl={{ formatMessage }}
53
55
  isFullMode={isFullMode}
@@ -60,9 +62,15 @@ describe('Creatives Whatsapp test1/>', () => {
60
62
  );
61
63
  };
62
64
 
63
- it('should render create mode', () => {
65
+ it('should render create mode for twilio/karix', () => {
64
66
  renderHelper({});
65
67
  expect(renderedComponent).toMatchSnapshot();
68
+ renderHelper({}, true, accountData2);
69
+ expect(renderedComponent).toMatchSnapshot();
70
+ renderHelper({}, true, accountData3);
71
+ expect(renderedComponent).toMatchSnapshot();
72
+ renderHelper({}, true, {});
73
+ expect(renderedComponent).toMatchSnapshot();
66
74
  });
67
75
 
68
76
  it('template name change', () => {
@@ -89,6 +97,12 @@ describe('Creatives Whatsapp test1/>', () => {
89
97
  .props()
90
98
  .onChange('RESERVATION_UPDATE');
91
99
  expect(renderedComponent).toMatchSnapshot();
100
+ renderHelper({}, true, accountData2);
101
+ renderedComponent
102
+ .find('CapSelect#select-whatsapp-category')
103
+ .props()
104
+ .onChange('TRANSACTIONAL');
105
+ expect(renderedComponent).toMatchSnapshot();
92
106
  });
93
107
 
94
108
  it('template language change', () => {
@@ -1,9 +1,23 @@
1
1
  export const mockData = {
2
- accountData: {
2
+ accountData1: {
3
3
  selectedWhatsappAccount: {
4
4
  name: 'WhatsppTest',
5
5
  sourceAccountIdentifier: 'AC41030cebba9e2f1ce37c78235da0ee18',
6
6
  configs: { accessToken: '4676323eb5d1f975b0987070c03a8efc' },
7
+ hostName: 'twiliowhatsapptrans',
8
+ },
9
+ },
10
+ accountData2: {
11
+ selectedWhatsappAccount: {
12
+ name: 'WhatsappAccount',
13
+ sourceAccountIdentifier: '107499611940863',
14
+ configs: { accessToken: 'Bearer gDwEuRIm9icV6phixociSw==' },
15
+ hostName: 'karixwhatsappbulk',
16
+ },
17
+ },
18
+ accountData3: {
19
+ selectedWhatsappAccount: {
20
+ test: 'test',
7
21
  },
8
22
  },
9
23
  editData1: {
@@ -9,14 +9,16 @@ import mockdata from '../../mockdata';
9
9
  const {
10
10
  whatsappPreviewTemplateData,
11
11
  whatsappPreviewTemplateData2,
12
- getWhatsappStatusOutput,
13
- getWhatsappCategoryOutput,
12
+ getWhatsappStatusOutput1,
13
+ getWhatsappCategoryOutput1,
14
+ getWhatsappCategoryOutput2,
14
15
  } = mockdata;
15
16
 
16
17
  describe('Test utils', () => {
17
18
  it('test getWhatsappContent', () => {
18
19
  expect(getWhatsappContent(whatsappPreviewTemplateData)).toMatchSnapshot();
19
20
  expect(getWhatsappContent(whatsappPreviewTemplateData2)).toMatchSnapshot();
21
+ expect(getWhatsappContent({})).toMatchSnapshot();
20
22
  });
21
23
 
22
24
  it('test getWhatsappContent for preview', () => {
@@ -28,15 +30,19 @@ describe('Test utils', () => {
28
30
  it('test getWhatsappCta', () => {
29
31
  expect(getWhatsappCta(whatsappPreviewTemplateData)).toMatchSnapshot();
30
32
  expect(getWhatsappCta(whatsappPreviewTemplateData2)).toMatchSnapshot();
33
+ expect(getWhatsappCta({})).toMatchSnapshot();
31
34
  });
32
35
 
33
36
  it('test getWhatsappStatus', () => {
34
- expect(getWhatsappStatus('approved')).toEqual(getWhatsappStatusOutput);
37
+ expect(getWhatsappStatus('approved')).toEqual(getWhatsappStatusOutput1);
35
38
  });
36
39
 
37
40
  it('test getWhatsappCategory', () => {
38
- expect(getWhatsappCategory('ALERT_UPDATE')).toEqual(
39
- getWhatsappCategoryOutput,
41
+ expect(getWhatsappCategory('ALERT_UPDATE', 'twiliowhatsapptrans')).toEqual(
42
+ getWhatsappCategoryOutput1,
43
+ );
44
+ expect(getWhatsappCategory('TRANSACTIONAL', 'karixwhatsappbulk')).toEqual(
45
+ getWhatsappCategoryOutput2,
40
46
  );
41
47
  });
42
48
  });