@capillarytech/creatives-library 7.14.29 → 7.14.30

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": "7.14.29",
4
+ "version": "7.14.30",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -1,31 +1,88 @@
1
- import { getSenderDetails, uploadFile, getCdnTransformationConfig } from "../api";
1
+ import {
2
+ getSenderDetails,
3
+ uploadFile,
4
+ getCdnTransformationConfig,
5
+ createWhatsappTemplate
6
+ } from '../api';
7
+ const sampleFile = require('../../assets/line.png');
2
8
 
3
- describe("getSenderDetails -- Test with valid responses", () => {
4
- it("Should return correct response", () =>
5
- expect(getSenderDetails("WHATSAPP", -1)).toEqual(Promise.resolve()));
9
+ describe('getSenderDetails -- Test with valid responses', () => {
10
+ it('Should return correct response', () =>
11
+ expect(getSenderDetails('WHATSAPP', -1)).toEqual(Promise.resolve()));
6
12
  });
7
13
 
8
- describe("getCdnTransformationConfigs -- Test with valid responses", () => {
9
- it("Should return correct response", () =>
14
+ describe('getCdnTransformationConfigs -- Test with valid responses', () => {
15
+ it('Should return correct response', () =>
10
16
  expect(getCdnTransformationConfig()).toEqual(Promise.resolve()));
11
17
  });
12
18
 
13
- describe("uploadFile -- whatsapp image upload", () => {
14
- it("Should return correct response", () =>
19
+ describe('uploadFile -- whatsapp image upload', () => {
20
+ it('Should return correct response', () =>
15
21
  expect(
16
22
  uploadFile({
17
23
  file: new Image(),
18
- assetType: "image",
24
+ assetType: 'image',
19
25
  fileParams: {
20
26
  width: 275,
21
27
  height: 183,
22
28
  error: false,
23
29
  },
24
30
  whatsappParams: {
25
- source: "whatsapp",
26
- wabaId: "107499611940863",
27
- accessToken: "Bearer gDwEuRIm9icV6phixociSw==",
31
+ source: 'whatsapp',
32
+ wabaId: '107499611940863',
33
+ accessToken: 'Bearer gDwEuRIm9icV6phixociSw==',
34
+ hostName: 'karixwhatsappbulk',
28
35
  },
29
- })
36
+ }),
37
+ ).toEqual(Promise.resolve()));
38
+ });
39
+
40
+ describe('createWhatsappTemplate -- Test with valid responses', () => {
41
+ it('Should return correct response', () =>
42
+ expect(
43
+ createWhatsappTemplate(sampleFile, {
44
+ name: 'mar_15_10_9',
45
+ versions: {
46
+ base: {
47
+ content: {
48
+ whatsapp: {
49
+ category: 'TRANSACTIONAL',
50
+ languages: [
51
+ {
52
+ language: 'en',
53
+ content:
54
+ 'Hey {{1}}, your appointment for {{2}} is confirmed.\nClick {{3}} to unsubscribe',
55
+ },
56
+ ],
57
+ buttonType: 'CTA',
58
+ buttons: [
59
+ {
60
+ index: 0,
61
+ type: 'PHONE_NUMBER',
62
+ text: 'call',
63
+ phone_number: '+919738751234',
64
+ },
65
+ {
66
+ index: 1,
67
+ type: 'DYNAMIC_URL',
68
+ text: 'info',
69
+ url: 'https://github.com/Capillary/{{1}}',
70
+ },
71
+ ],
72
+ mediaType: 'IMAGE',
73
+ imageUrl:
74
+ 'https://storage.crm.n.content-cdn.io/cdn-cgi/image/quality=70,/intouch_creative_assets/7e167b76-7276-4de3-a767-3d1ae9ae.jpg',
75
+ karixFileHandle: '',
76
+ varMapped: {},
77
+ templateEditor: false,
78
+ accountId: '2000222347',
79
+ accessToken: 'DTpZEh4VK',
80
+ hostName: 'gupshupwhatsappbulk',
81
+ },
82
+ },
83
+ },
84
+ },
85
+ type: 'WHATSAPP',
86
+ }),
30
87
  ).toEqual(Promise.resolve()));
31
88
  });
@@ -152,4 +152,20 @@ describe('CapWhatsappCTA', () => {
152
152
  screen.getByText(/https:\/\/www\.google\.co\.in/i),
153
153
  ).toBeInTheDocument();
154
154
  });
155
+ it('Test if gupshup CapWhatsappCTA component renders', () => {
156
+ initializeComponent([
157
+ {
158
+ index: 0,
159
+ ctaType: 'WEBSITE',
160
+ text: 'info',
161
+ phone_number: '',
162
+ urlType: 'STATIC_URL',
163
+ url: 'https://www.google.co.in',
164
+ isSaved: false,
165
+ },
166
+ ], false, 'gupshupwhatsappbulk');
167
+ expect(screen.getByText('Type of action')).toBeInTheDocument();
168
+ expect(screen.getByText('Button text')).toBeInTheDocument();
169
+ expect(screen.getByRole('button', { name: /save/i })).toBeEnabled();
170
+ });
155
171
  });
@@ -1157,7 +1157,7 @@ export const Whatsapp = (props) => {
1157
1157
  <CapSelect
1158
1158
  id="select-whatsapp-category"
1159
1159
  options={
1160
- host === HOST_KARIX ? karixGupshupCategoryOptions : twilioCategoryOptions
1160
+ host === HOST_TWILIO ? twilioCategoryOptions : karixGupshupCategoryOptions
1161
1161
  }
1162
1162
  onChange={onTemplateCategoryChange}
1163
1163
  value={templateCategory}