@capillarytech/creatives-library 7.17.134-alpha.0 → 7.17.135
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/config/app.js
CHANGED
|
@@ -16,13 +16,13 @@ const config = {
|
|
|
16
16
|
accountConfig: (strs, accountId) => `${window.location.origin}/org/config/AccountAdd?q=a&channelId=2&accountId=${accountId}&edit=1`,
|
|
17
17
|
},
|
|
18
18
|
development: {
|
|
19
|
-
api_endpoint: 'https://nightly.
|
|
20
|
-
campaigns_api_endpoint: 'https://nightly.
|
|
21
|
-
campaigns_api_org_endpoint: 'https://nightly.
|
|
22
|
-
auth_endpoint: 'https://nightly.
|
|
23
|
-
arya_endpoint: 'https://nightly.
|
|
24
|
-
subscription_api_endpoint: 'https://nightly.
|
|
25
|
-
exports_api_endpoint: 'https://nightly.
|
|
19
|
+
api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/creatives',
|
|
20
|
+
campaigns_api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/iris/v2/campaigns',
|
|
21
|
+
campaigns_api_org_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/iris/v2/org/campaign',
|
|
22
|
+
auth_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/auth',
|
|
23
|
+
arya_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1',
|
|
24
|
+
subscription_api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/org-settings/subscription',
|
|
25
|
+
exports_api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/export/data',
|
|
26
26
|
login_url: '/auth/login',
|
|
27
27
|
dashboard_url: '/sms',
|
|
28
28
|
dashboard_url_v2: '/v2',
|
package/package.json
CHANGED
package/services/api.js
CHANGED
|
@@ -527,7 +527,11 @@ export const getS3UrlFileSizes = (data) => {
|
|
|
527
527
|
|
|
528
528
|
export const getTemplateInfoById = ({id, username, oa_id, token}) => {
|
|
529
529
|
const url = `${API_ENDPOINT}/templates/${id}/Zalo?username=${username}&oa_id=${oa_id}&token=${token}`;
|
|
530
|
-
|
|
530
|
+
const compressedTemplatesData = request(url, getAPICallObject('GET'));
|
|
531
|
+
return compressedTemplatesData.then(async (data) => {
|
|
532
|
+
const { response = '' } = data || {};
|
|
533
|
+
return { ...data, response: await decompressJsonObject(response)};
|
|
534
|
+
});
|
|
531
535
|
};
|
|
532
536
|
|
|
533
537
|
export const getMetaTags = ({previewUrl}) => {
|
|
@@ -544,5 +548,3 @@ export const getNavigationConfigApi = async () => {
|
|
|
544
548
|
const url = `${ARYA_ENDPOINT}/navigations`;
|
|
545
549
|
return await request(url, getAPICallObject('GET'));
|
|
546
550
|
};
|
|
547
|
-
|
|
548
|
-
export {request, getAPICallObject};
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
getNavigationConfigApi,
|
|
9
9
|
getAllTemplates,
|
|
10
10
|
getTemplateDetails,
|
|
11
|
+
getTemplateInfoById,
|
|
11
12
|
} from '../api';
|
|
12
13
|
import { mockData } from './mockData';
|
|
13
14
|
const sampleFile = require('../../assets/line.png');
|
|
@@ -225,3 +226,68 @@ describe('getTemplateDetails -- Test with valid responses', () => {
|
|
|
225
226
|
});
|
|
226
227
|
});
|
|
227
228
|
});
|
|
229
|
+
|
|
230
|
+
describe('getTemplateInfoById -- Test with valid responses', () => {
|
|
231
|
+
beforeEach(() => {
|
|
232
|
+
global.fetch = jest.fn(); // Mocking global fetch function
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
afterEach(() => {
|
|
236
|
+
jest.restoreAllMocks(); // Restore all mocks after each test
|
|
237
|
+
});
|
|
238
|
+
it('Should return correct response', async () => {
|
|
239
|
+
global.fetch.mockReturnValue(Promise.resolve({
|
|
240
|
+
status: 200,
|
|
241
|
+
json: () => Promise.resolve({
|
|
242
|
+
status: 200,
|
|
243
|
+
response: {
|
|
244
|
+
_id: '123',
|
|
245
|
+
},
|
|
246
|
+
}),
|
|
247
|
+
}));
|
|
248
|
+
mockDecompressJsonObject.mockReturnValue(Promise.resolve({
|
|
249
|
+
_id: '123',
|
|
250
|
+
}));
|
|
251
|
+
expect(await getTemplateInfoById({id: '123', username: 'capillary_zns', 'oa_id': 'jfhagsdhj', token: 'tuyagjahs'})).toEqual({
|
|
252
|
+
response: {
|
|
253
|
+
_id: '123',
|
|
254
|
+
},
|
|
255
|
+
status: 200,
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
it('Should not return correct response', async () => {
|
|
260
|
+
global.fetch.mockReturnValue(Promise.resolve({
|
|
261
|
+
status: 200,
|
|
262
|
+
json: () => Promise.resolve({
|
|
263
|
+
status: 200,
|
|
264
|
+
data: {
|
|
265
|
+
_id: '123',
|
|
266
|
+
},
|
|
267
|
+
}),
|
|
268
|
+
}));
|
|
269
|
+
mockDecompressJsonObject.mockReturnValue(Promise.resolve({
|
|
270
|
+
_id: '123',
|
|
271
|
+
}));
|
|
272
|
+
expect(await getTemplateInfoById({id: '123', username: 'capillary_zns', 'oa_id': 'jfhagsdhj', token: 'tuyagjahs'})).toEqual({
|
|
273
|
+
data: {
|
|
274
|
+
_id: '123',
|
|
275
|
+
},
|
|
276
|
+
response: {
|
|
277
|
+
_id: '123',
|
|
278
|
+
},
|
|
279
|
+
status: 200,
|
|
280
|
+
});
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
it('Should not return correct response when data is undefined', async () => {
|
|
284
|
+
global.fetch.mockReturnValue(Promise.resolve({
|
|
285
|
+
status: 200,
|
|
286
|
+
json: () => Promise.resolve(),
|
|
287
|
+
}));
|
|
288
|
+
mockDecompressJsonObject.mockReturnValue(Promise.resolve());
|
|
289
|
+
expect(await getTemplateInfoById({id: '123', username: 'capillary_zns', 'oa_id': 'jfhagsdhj', token: 'tuyagjahs'})).toEqual({
|
|
290
|
+
response: undefined,
|
|
291
|
+
});
|
|
292
|
+
});
|
|
293
|
+
});
|
|
@@ -185,8 +185,6 @@ export class NavigationBar extends React.Component {
|
|
|
185
185
|
showDocumentationBot={showDocumentationBot}
|
|
186
186
|
setLeftNavbarExpandedProp={handleLeftNavBarExpanded}
|
|
187
187
|
headerOverideCss={headerOverideCss}
|
|
188
|
-
request={Api.request}
|
|
189
|
-
getAPICallObject={Api.getAPICallObject}
|
|
190
188
|
>
|
|
191
189
|
<div data-testid="cap-wrapper">
|
|
192
190
|
<CapWrapper isEmbedded={type === EMBEDDED}>
|