@capillarytech/creatives-library 7.16.1 → 7.16.3
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/app.js +2 -2
- package/components/TemplatePreview/index.js +1 -0
- package/containers/Assets/Gallery/messages.js +1 -1
- package/containers/Cap/sagas.js +4 -3
- package/containers/Cap/tests/__snapshots__/index.test.js.snap +4 -4
- package/containers/Cap/tests/saga.test.js +31 -0
- package/containers/Email/messages.js +1 -1
- package/package.json +1 -1
- package/services/api.js +1 -9
- package/styles/vendor/semantic/src/definitions/collections/form.less +2 -2
- package/styles/vendor/semantic/src/definitions/elements/flag.less +1 -1
- package/styles/vendor/semantic/src/definitions/elements/icon.less +0 -1
- package/styles/vendor/semantic/src/definitions/globals/site.less +1 -1
- package/translations/en.json +4 -4
- package/utils/common.js +13 -0
- package/utils/smsCharCountV2.js +0 -13
- package/utils/test-utils.js +0 -17
- package/utils/tests/v2Common.test.js +22 -2
- package/v2Components/CapDocumentUpload/index.js +6 -3
- package/v2Components/CapImageUpload/index.js +4 -2
- package/v2Components/CapVideoUpload/index.js +4 -3
- package/v2Components/FormBuilder/index.js +9 -31
- package/v2Containers/App/constants.js +1 -0
- package/v2Containers/Assets/Gallery/index.js +21 -3
- package/v2Containers/Assets/Gallery/messages.js +1 -1
- package/v2Containers/Cap/messages.js +4 -0
- package/v2Containers/Cap/sagas.js +4 -3
- package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +4 -4
- package/v2Containers/Cap/tests/saga.test.js +31 -0
- package/v2Containers/CreativesContainer/constants.js +0 -2
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +0 -8
- package/v2Containers/Email/messages.js +1 -1
- package/v2Containers/Line/Container/Image/index.js +4 -2
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +3397 -15
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +8 -8
- package/v2Containers/Line/Container/ImageMap/index.js +4 -2
- package/v2Containers/Line/Container/Video/index.js +5 -3
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +68 -68
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +72 -72
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +191 -197
- package/v2Containers/Sms/Create/actions.js +0 -9
- package/v2Containers/Sms/Create/constants.js +0 -2
- package/v2Containers/Sms/Create/index.js +0 -12
- package/v2Containers/Sms/Create/sagas.js +3 -19
- package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +16 -16
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +32 -32
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +0 -16
- package/v2Containers/Viber/index.js +4 -2
- package/v2Containers/Whatsapp/index.js +4 -2
- package/v2Containers/Whatsapp/messages.js +5 -0
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +284 -336
- package/v2Containers/ChannelTemplates/actions.js +0 -20
- package/v2Containers/ChannelTemplates/constants.js +0 -8
- package/v2Containers/ChannelTemplates/index.js +0 -47
- package/v2Containers/ChannelTemplates/messages.js +0 -13
- package/v2Containers/ChannelTemplates/reducer.js +0 -34
- package/v2Containers/ChannelTemplates/sagas.js +0 -32
- package/v2Containers/ChannelTemplates/selectors.js +0 -25
- package/v2Containers/Sms/Create/tests/sagas.test.js +0 -82
package/app.js
CHANGED
|
@@ -38,6 +38,8 @@ const store = configureStore(initialState, browserHistory);
|
|
|
38
38
|
const history = syncHistoryWithStore(browserHistory, store, {
|
|
39
39
|
selectLocationState: makeSelectLocationState(),
|
|
40
40
|
});
|
|
41
|
+
const BUGSNAG_APP_VERSION = `creatives-ui__${new Date().getTime()}`;
|
|
42
|
+
const BUGSNAG_API_KEY = 'c4d96446438ff7dc7c08da08ef94c5b2';
|
|
41
43
|
|
|
42
44
|
const bugSnagErrorCallback = (event) => {
|
|
43
45
|
const { app: { releaseStage } = {}, originalError } = event || {};
|
|
@@ -87,9 +89,7 @@ const bugSnagErrorCallback = (event) => {
|
|
|
87
89
|
};
|
|
88
90
|
|
|
89
91
|
Bugsnag.start({
|
|
90
|
-
// eslint-disable-next-line no-undef
|
|
91
92
|
appVersion: BUGSNAG_APP_VERSION,
|
|
92
|
-
// eslint-disable-next-line no-undef
|
|
93
93
|
apiKey: BUGSNAG_API_KEY,
|
|
94
94
|
releaseStage: window.location.hostname,
|
|
95
95
|
plugins: [new BugsnagPluginReact()],
|
|
@@ -27,6 +27,7 @@ const wechatBody = require('./assets/images/WECHAT_5x.png');
|
|
|
27
27
|
const smsBody = require('./assets/images/mobile.svg');
|
|
28
28
|
const androidPushMessagePhone = require('./assets/images/androidPushMessage.svg');
|
|
29
29
|
const iPhonePushMessagePhone = require('./assets/images/iPhonePushMessage.svg');
|
|
30
|
+
const lineVideoPlaceholder = require('../../assets/rich-video-placeholder.svg');
|
|
30
31
|
import { CAP_COLOR_03, CAP_WHITE, FONT_COLOR_01, CAP_G08, CAP_G06 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
31
32
|
import { TEMPLATE, IMAGE_CAROUSEL, IMAGE_MAP_CAMEL_CASE, IMAGE, STICKER, TEXT, VIDEO } from '../../v2Containers/Line/Container/constants';
|
|
32
33
|
|
|
@@ -76,7 +76,7 @@ export default defineMessages({
|
|
|
76
76
|
},
|
|
77
77
|
assetUploadFailed: {
|
|
78
78
|
id: 'creatives.containers.Assets.Gallery.assetUploadFailed',
|
|
79
|
-
defaultMessage: 'Image
|
|
79
|
+
defaultMessage: 'Image upload failed',
|
|
80
80
|
},
|
|
81
81
|
assetDeleteSuccess: {
|
|
82
82
|
id: 'creatives.containers.Assets.Gallery.assetDeleteSuccess',
|
package/containers/Cap/sagas.js
CHANGED
|
@@ -7,7 +7,7 @@ import * as types from './constants';
|
|
|
7
7
|
import config from '../../config/app';
|
|
8
8
|
// import {makeSelectOrgId} from './selectors';
|
|
9
9
|
|
|
10
|
-
function* authorize(user) {
|
|
10
|
+
export function* authorize(user) {
|
|
11
11
|
try {
|
|
12
12
|
const res = yield call(Api.authorize, user);
|
|
13
13
|
yield call(LocalStorage.saveItem, 'token', res.token);
|
|
@@ -35,13 +35,14 @@ function* switchOrg({orgID}) {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
function* loginFlow() {
|
|
39
|
-
|
|
38
|
+
export function* loginFlow() {
|
|
39
|
+
let condition = true;
|
|
40
40
|
while (condition) {
|
|
41
41
|
const { user } = yield take(types.LOGIN_REQUEST);
|
|
42
42
|
const task = yield fork(authorize, user);
|
|
43
43
|
const action = yield take([types.LOGOUT_REQUEST, types.LOGIN_FAILURE]);
|
|
44
44
|
if (action.type === types.LOGOUT_REQUEST) {
|
|
45
|
+
condition = false;
|
|
45
46
|
yield cancel(task);
|
|
46
47
|
}
|
|
47
48
|
// yield call(LocalStorage.clearItem, 'token');
|
|
@@ -323,7 +323,7 @@ exports[`<Cap /> should render its children 1`] = `
|
|
|
323
323
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
324
324
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
325
325
|
"creatives.containers.Assets.Gallery.assetDeleteSuccess": "Image deleted successfully.",
|
|
326
|
-
"creatives.containers.Assets.Gallery.assetUploadFailed": "Image
|
|
326
|
+
"creatives.containers.Assets.Gallery.assetUploadFailed": "Image upload failed",
|
|
327
327
|
"creatives.containers.Assets.Gallery.assetUploadSuccess": "Image uploaded successfully",
|
|
328
328
|
"creatives.containers.Assets.Gallery.backToGallery": "Back to image gallery",
|
|
329
329
|
"creatives.containers.Assets.Gallery.delete": "Delete",
|
|
@@ -470,7 +470,7 @@ exports[`<Cap /> should render its children 1`] = `
|
|
|
470
470
|
"creatives.containers.Email.Tags": "Tags",
|
|
471
471
|
"creatives.containers.Email.alphabetically": "Alphabetically",
|
|
472
472
|
"creatives.containers.Email.alphabeticallyOption": "Alphabetically",
|
|
473
|
-
"creatives.containers.Email.assetUploadFailed": "Image
|
|
473
|
+
"creatives.containers.Email.assetUploadFailed": "Image upload failed",
|
|
474
474
|
"creatives.containers.Email.blankTemplate": "Blank template",
|
|
475
475
|
"creatives.containers.Email.cancel": "Cancel",
|
|
476
476
|
"creatives.containers.Email.createHeading": "Create email template",
|
|
@@ -875,7 +875,7 @@ exports[`<Cap /> should render its children 1`] = `
|
|
|
875
875
|
"creatives.containersV2.Assets.Gallery.alphabetically": "Alphabetically",
|
|
876
876
|
"creatives.containersV2.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
877
877
|
"creatives.containersV2.Assets.Gallery.assetDeleteSuccess": "Image deleted successfully.",
|
|
878
|
-
"creatives.containersV2.Assets.Gallery.assetUploadFailed": "Image
|
|
878
|
+
"creatives.containersV2.Assets.Gallery.assetUploadFailed": "Image upload failed",
|
|
879
879
|
"creatives.containersV2.Assets.Gallery.assetUploadSuccess": "Image uploaded successfully",
|
|
880
880
|
"creatives.containersV2.Assets.Gallery.backToGallery": "Back to image gallery",
|
|
881
881
|
"creatives.containersV2.Assets.Gallery.delete": "Delete",
|
|
@@ -1133,7 +1133,7 @@ exports[`<Cap /> should render its children 1`] = `
|
|
|
1133
1133
|
"creatives.containersV2.Email.alertMessage": "Alert",
|
|
1134
1134
|
"creatives.containersV2.Email.alphabetically": "Alphabetically",
|
|
1135
1135
|
"creatives.containersV2.Email.alphabeticallyOption": "Alphabetically",
|
|
1136
|
-
"creatives.containersV2.Email.assetUploadFailed": "Image
|
|
1136
|
+
"creatives.containersV2.Email.assetUploadFailed": "Image upload failed",
|
|
1137
1137
|
"creatives.containersV2.Email.blankTemplate": "Blank template",
|
|
1138
1138
|
"creatives.containersV2.Email.cancel": "Cancel",
|
|
1139
1139
|
"creatives.containersV2.Email.copyPrimaryLanguage": "Copy Primary Language",
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { authorize, loginFlow } from '../sagas';
|
|
2
|
+
import { take, fork, cancel } from 'redux-saga/effects';
|
|
3
|
+
import {
|
|
4
|
+
LOGIN_REQUEST,
|
|
5
|
+
LOGIN_FAILURE,
|
|
6
|
+
LOGOUT_REQUEST,
|
|
7
|
+
} from '../constants';
|
|
8
|
+
describe('loginFlow', () => {
|
|
9
|
+
it('should handle the login flow', () => {
|
|
10
|
+
const generator = loginFlow();
|
|
11
|
+
const user = { username: 'testuser', password: 'password123' };
|
|
12
|
+
let task;
|
|
13
|
+
|
|
14
|
+
// First iteration
|
|
15
|
+
expect(generator.next().value).toEqual(take(LOGIN_REQUEST));
|
|
16
|
+
expect(generator.next({ user }).value).toEqual(fork(authorize, user));
|
|
17
|
+
task = generator.next().value; // Assign the task value
|
|
18
|
+
try{
|
|
19
|
+
const logoutAction = { type: LOGOUT_REQUEST };
|
|
20
|
+
const failureAction = { type: LOGIN_FAILURE };
|
|
21
|
+
|
|
22
|
+
expect(generator.next(logoutAction).value).toEqual(cancel(task));
|
|
23
|
+
|
|
24
|
+
// When LOGIN_FAILURE action is dispatched
|
|
25
|
+
expect(generator.next(failureAction).value).toEqual(take(LOGIN_REQUEST));
|
|
26
|
+
expect(generator.next().value).toEqual(fork(authorize, user));
|
|
27
|
+
expect(generator.next().done).toBe(true);
|
|
28
|
+
}
|
|
29
|
+
catch{}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -228,7 +228,7 @@ export default defineMessages({
|
|
|
228
228
|
},
|
|
229
229
|
"assetUploadFailed": {
|
|
230
230
|
id: 'creatives.containers.Email.assetUploadFailed',
|
|
231
|
-
defaultMessage: 'Image
|
|
231
|
+
defaultMessage: 'Image upload failed',
|
|
232
232
|
},
|
|
233
233
|
"goBackConfirmation": {
|
|
234
234
|
id: 'creatives.containers.Email.Create.goBackConfirmation',
|
package/package.json
CHANGED
package/services/api.js
CHANGED
|
@@ -498,12 +498,4 @@ export const getCdnTransformationConfig = () => {
|
|
|
498
498
|
export const getS3UrlFileSizes = (data) => {
|
|
499
499
|
const url = `${API_ENDPOINT}/assets/files/metadata`;
|
|
500
500
|
return request(url, getAPICallObject('POST', data));
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
// TODO: Update this url with Aira node API
|
|
504
|
-
export const getAiSuggestions = (data) => {
|
|
505
|
-
const url = `https://capgpt.chinmayjain.live/chat-completion`;
|
|
506
|
-
return request(url, getAPICallObject('POST', {...data,
|
|
507
|
-
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoiY2hpbm1heWphaW4wOEBnbWFpbC5jb20iLCJpYXQiOjE2ODE3OTc5NzN9.-o_9fiZqvrdx_prcW0Qicu1fKVJU2ysO5t4g9HkYb2M"
|
|
508
|
-
}));
|
|
509
|
-
};
|
|
501
|
+
}
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
margin: 0em;
|
|
116
116
|
outline: none;
|
|
117
117
|
-webkit-appearance: none;
|
|
118
|
-
tap-highlight-color: rgba(255, 255, 255, 0);
|
|
118
|
+
-webkit-tap-highlight-color: rgba(255, 255, 255, 0);
|
|
119
119
|
|
|
120
120
|
line-height: @inputLineHeight;
|
|
121
121
|
padding: @inputPadding;
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
.ui.form textarea {
|
|
134
134
|
margin: 0em;
|
|
135
135
|
-webkit-appearance: none;
|
|
136
|
-
tap-highlight-color: rgba(255, 255, 255, 0);
|
|
136
|
+
-webkit-tap-highlight-color: rgba(255, 255, 255, 0);
|
|
137
137
|
|
|
138
138
|
padding: @textAreaPadding;
|
|
139
139
|
font-size: @textAreaFontSize;
|
package/translations/en.json
CHANGED
|
@@ -281,7 +281,7 @@
|
|
|
281
281
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
282
282
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
283
283
|
"creatives.containers.Assets.Gallery.assetDeleteSuccess": "Image deleted successfully.",
|
|
284
|
-
"creatives.containers.Assets.Gallery.assetUploadFailed": "Image
|
|
284
|
+
"creatives.containers.Assets.Gallery.assetUploadFailed": "Image upload failed",
|
|
285
285
|
"creatives.containers.Assets.Gallery.assetUploadSuccess": "Image uploaded successfully",
|
|
286
286
|
"creatives.containers.Assets.Gallery.backToGallery": "Back to image gallery",
|
|
287
287
|
"creatives.containers.Assets.Gallery.delete": "Delete",
|
|
@@ -428,7 +428,7 @@
|
|
|
428
428
|
"creatives.containers.Email.Tags": "Tags",
|
|
429
429
|
"creatives.containers.Email.alphabetically": "Alphabetically",
|
|
430
430
|
"creatives.containers.Email.alphabeticallyOption": "Alphabetically",
|
|
431
|
-
"creatives.containers.Email.assetUploadFailed": "Image
|
|
431
|
+
"creatives.containers.Email.assetUploadFailed": "Image upload failed",
|
|
432
432
|
"creatives.containers.Email.blankTemplate": "Blank template",
|
|
433
433
|
"creatives.containers.Email.cancel": "Cancel",
|
|
434
434
|
"creatives.containers.Email.createHeading": "Create email template",
|
|
@@ -833,7 +833,7 @@
|
|
|
833
833
|
"creatives.containersV2.Assets.Gallery.alphabetically": "Alphabetically",
|
|
834
834
|
"creatives.containersV2.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
835
835
|
"creatives.containersV2.Assets.Gallery.assetDeleteSuccess": "Image deleted successfully.",
|
|
836
|
-
"creatives.containersV2.Assets.Gallery.assetUploadFailed": "Image
|
|
836
|
+
"creatives.containersV2.Assets.Gallery.assetUploadFailed": "Image upload failed",
|
|
837
837
|
"creatives.containersV2.Assets.Gallery.assetUploadSuccess": "Image uploaded successfully",
|
|
838
838
|
"creatives.containersV2.Assets.Gallery.backToGallery": "Back to image gallery",
|
|
839
839
|
"creatives.containersV2.Assets.Gallery.delete": "Delete",
|
|
@@ -1091,7 +1091,7 @@
|
|
|
1091
1091
|
"creatives.containersV2.Email.alertMessage": "Alert",
|
|
1092
1092
|
"creatives.containersV2.Email.alphabetically": "Alphabetically",
|
|
1093
1093
|
"creatives.containersV2.Email.alphabeticallyOption": "Alphabetically",
|
|
1094
|
-
"creatives.containersV2.Email.assetUploadFailed": "Image
|
|
1094
|
+
"creatives.containersV2.Email.assetUploadFailed": "Image upload failed",
|
|
1095
1095
|
"creatives.containersV2.Email.blankTemplate": "Blank template",
|
|
1096
1096
|
"creatives.containersV2.Email.cancel": "Cancel",
|
|
1097
1097
|
"creatives.containersV2.Email.copyPrimaryLanguage": "Copy Primary Language",
|
package/utils/common.js
CHANGED
|
@@ -262,3 +262,16 @@ export const isTraiDLTEnable = (isFullMode, smsRegister) => {
|
|
|
262
262
|
const isTraiDltFeature = isTraiDltFeatureForOrg && isTraiEnableforLib;
|
|
263
263
|
return isTraiDltFeature;
|
|
264
264
|
};
|
|
265
|
+
|
|
266
|
+
export function createNewFile(fileObject) {
|
|
267
|
+
const encodedName = fileObject.name.replace(/(.+?)(\.[^.]*$|$)/, (match, name, extension) => {
|
|
268
|
+
const filename = encodeURIComponent(name);
|
|
269
|
+
return filename + extension;
|
|
270
|
+
});
|
|
271
|
+
const { type, ...rest } = fileObject;
|
|
272
|
+
const newFile = new File([fileObject], encodedName, { type, ...rest });
|
|
273
|
+
newFile.uid = fileObject.uid;
|
|
274
|
+
|
|
275
|
+
return newFile;
|
|
276
|
+
}
|
|
277
|
+
|
package/utils/smsCharCountV2.js
CHANGED
|
@@ -30,19 +30,6 @@ function charToSpan(chr, coding, isUnicodeEnabled) {
|
|
|
30
30
|
return <span className={isUnicode ? 'unicode-disabled' : ''}>{isUnicode ? ` \u2588 ` : chr}</span>
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
function getUHDHtml(parts, part) {
|
|
34
|
-
if (parts < 15) {
|
|
35
|
-
udh.find('.udh-total').html('0x0' + parts.toString(16));
|
|
36
|
-
} else {
|
|
37
|
-
udh.find('.udh-total').html('0x' + parts.toString(16));
|
|
38
|
-
}
|
|
39
|
-
if (part < 15) {
|
|
40
|
-
udh.find('.udh-part').html('0x0' + part.toString(16));
|
|
41
|
-
} else {
|
|
42
|
-
udh.find('.udh-part').html('0x' + part.toString(16));
|
|
43
|
-
}
|
|
44
|
-
return udh;
|
|
45
|
-
}
|
|
46
33
|
export function checkUnicode(content) {
|
|
47
34
|
var chars_arr = content.split("");
|
|
48
35
|
for (let i = 0; i < chars_arr.length; i++) {
|
package/utils/test-utils.js
CHANGED
|
@@ -42,22 +42,5 @@ function renderWithRouter(
|
|
|
42
42
|
// re-export everything
|
|
43
43
|
export * from '@testing-library/react';
|
|
44
44
|
|
|
45
|
-
/**
|
|
46
|
-
* Custom text matcher to find element if text is broken/made up of multiple elements.
|
|
47
|
-
* @param {string or regex} textMatch
|
|
48
|
-
* @returns for string entire text should match, use regex for partial matching.
|
|
49
|
-
*/
|
|
50
|
-
export function textContentMatcher(textMatch) {
|
|
51
|
-
return function (_content, node) {
|
|
52
|
-
const hasText = (n) =>
|
|
53
|
-
node.textContent === textMatch || node.textContent.match(textMatch);
|
|
54
|
-
const nodeHasText = hasText(node);
|
|
55
|
-
const childrenDontHaveText = Array.from(n?.children || []).every(
|
|
56
|
-
(child) => !hasText(child),
|
|
57
|
-
);
|
|
58
|
-
return nodeHasText && childrenDontHaveText;
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
45
|
// override render method
|
|
63
46
|
export { render, renderWithRouter };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { getObjFromQueryParams
|
|
3
|
-
|
|
2
|
+
import { getObjFromQueryParams} from '../v2common';
|
|
3
|
+
import {createNewFile} from '../common';
|
|
4
4
|
describe('Test v2common container', () => {
|
|
5
5
|
it('test getObjFromQueryParams', () => {
|
|
6
6
|
expect(getObjFromQueryParams("?channel=WHATSAPP&mode=CREATE")).toEqual({
|
|
@@ -9,3 +9,23 @@ describe('Test v2common container', () => {
|
|
|
9
9
|
});
|
|
10
10
|
});
|
|
11
11
|
});
|
|
12
|
+
|
|
13
|
+
describe('Test createNewFile function', () => {
|
|
14
|
+
it('should create a new file with encoded name', () => {
|
|
15
|
+
const tempFile = {
|
|
16
|
+
name: '#image.png',
|
|
17
|
+
type: 'image/jpeg',
|
|
18
|
+
size: 2048,
|
|
19
|
+
uid: 'def456',
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const expectedFile = new File([tempFile], '%23image.png', {
|
|
23
|
+
type: 'image/jpeg',
|
|
24
|
+
size: 2048,
|
|
25
|
+
uid: 'def456',
|
|
26
|
+
});
|
|
27
|
+
const result = createNewFile(tempFile);
|
|
28
|
+
expect(result).toMatchObject(expectedFile);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
@@ -13,6 +13,7 @@ import isEmpty from 'lodash/isEmpty';
|
|
|
13
13
|
import './index.scss';
|
|
14
14
|
import messages from './messages';
|
|
15
15
|
import { convertPdfToImages } from '../WhatsappDocumentPreview/index';
|
|
16
|
+
import { createNewFile } from '../../utils/common';
|
|
16
17
|
|
|
17
18
|
function CapDocumentUpload(props) {
|
|
18
19
|
const {
|
|
@@ -39,7 +40,7 @@ function CapDocumentUpload(props) {
|
|
|
39
40
|
const { secure_file_path = '', karixFileHandle = '', name = '', file_size = ''} = get(docDataObj, 'metaInfo', {});
|
|
40
41
|
setWhatsappDocParams({
|
|
41
42
|
...whatsappDocParams,
|
|
42
|
-
whatsappDocName: `${name.slice(0, -13)}.pdf`,
|
|
43
|
+
whatsappDocName: `${decodeURIComponent(name.slice(0, -13))}.pdf`,
|
|
43
44
|
//sliced to show the actual name of the pdf to the user and in the preview, this remove suffix appended to the name on creatives node side
|
|
44
45
|
whatsappDocSize: file_size,
|
|
45
46
|
});
|
|
@@ -70,10 +71,11 @@ function CapDocumentUpload(props) {
|
|
|
70
71
|
}
|
|
71
72
|
const _URL = window.URL || window.webkitURL;
|
|
72
73
|
let incorrectFile = false;
|
|
73
|
-
const
|
|
74
|
-
if (!allowedExtensionsRegex.test(
|
|
74
|
+
const tempFile = files[0];
|
|
75
|
+
if (!allowedExtensionsRegex.test(tempFile?.name)) {
|
|
75
76
|
incorrectFile = true;
|
|
76
77
|
}
|
|
78
|
+
const file = createNewFile(tempFile);
|
|
77
79
|
const doc = new FileReader();
|
|
78
80
|
doc.src = _URL.createObjectURL(file);
|
|
79
81
|
const fileParams = {
|
|
@@ -86,6 +88,7 @@ function CapDocumentUpload(props) {
|
|
|
86
88
|
...whatsappDocParams,
|
|
87
89
|
whatsappDocImg: data?.image,
|
|
88
90
|
whatsappDocPages: data?.numberOfPages,
|
|
91
|
+
nameEncoded: true,
|
|
89
92
|
})
|
|
90
93
|
);
|
|
91
94
|
submitAction({file, type: 'document', fileParams}, incorrectFile);
|
|
@@ -23,6 +23,7 @@ import Gallery from '../../v2Containers/Assets/Gallery';
|
|
|
23
23
|
import { FACEBOOK, RCS, WHATSAPP } from "../../v2Containers/CreativesContainer/constants";
|
|
24
24
|
|
|
25
25
|
import messages from './messages';
|
|
26
|
+
import { createNewFile } from '../../utils/common';
|
|
26
27
|
function CapImageUpload(props) {
|
|
27
28
|
const {
|
|
28
29
|
intl,
|
|
@@ -79,10 +80,11 @@ function CapImageUpload(props) {
|
|
|
79
80
|
}
|
|
80
81
|
const _URL = window.URL || window.webkitURL;
|
|
81
82
|
let incorrectFile = false;
|
|
82
|
-
const
|
|
83
|
-
if (!allowedExtensionsRegex.test(
|
|
83
|
+
const tempFile = files[0];
|
|
84
|
+
if (!allowedExtensionsRegex.test(tempFile?.name)) {
|
|
84
85
|
incorrectFile = true;
|
|
85
86
|
}
|
|
87
|
+
const file = createNewFile(tempFile);
|
|
86
88
|
const img = new Image();
|
|
87
89
|
img.src = _URL.createObjectURL(file);
|
|
88
90
|
img.onload = () => {
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
CapSpin,
|
|
19
19
|
} from '@capillarytech/cap-ui-library';
|
|
20
20
|
import messages from './messages';
|
|
21
|
-
import {bytes2Size} from '../../utils/common';
|
|
21
|
+
import {bytes2Size, createNewFile} from '../../utils/common';
|
|
22
22
|
import { WHATSAPP } from './constants';
|
|
23
23
|
import './index.scss';
|
|
24
24
|
|
|
@@ -65,10 +65,11 @@ function CapVideoUpload(props) {
|
|
|
65
65
|
}
|
|
66
66
|
const _URL = window.URL || window.webkitURL;
|
|
67
67
|
let incorrectFile = false;
|
|
68
|
-
const
|
|
69
|
-
if (!allowedExtensionsRegex.test(
|
|
68
|
+
const tempFile = files[0];
|
|
69
|
+
if (!allowedExtensionsRegex.test(tempFile?.name)) {
|
|
70
70
|
incorrectFile = true;
|
|
71
71
|
}
|
|
72
|
+
const file = createNewFile(tempFile);
|
|
72
73
|
const video = new FileReader();
|
|
73
74
|
video.src = _URL.createObjectURL(file);
|
|
74
75
|
const fileParams = {
|
|
@@ -11,11 +11,9 @@ import PropTypes from 'prop-types';
|
|
|
11
11
|
import React from 'react';
|
|
12
12
|
import _ from 'lodash';
|
|
13
13
|
import { Tabs, Table, Modal} from 'antd';
|
|
14
|
-
import {
|
|
15
|
-
import { CapSpin, CapDrawer, CapButton, CapInput, CapPopover, CapImage, CapCheckbox, CapRadio, CapSelect, CapTable, CapRow, CapColumn, CapNotification, CapUploader, CapHeading, CapIcon, CapTooltip, CapAiSuggestions} from '@capillarytech/cap-ui-library';
|
|
14
|
+
import { CapSpin, CapDrawer, CapButton, CapInput, CapPopover, CapImage, CapCheckbox, CapRadio, CapSelect, CapTable, CapRow, CapColumn, CapNotification, CapUploader, CapHeading, CapIcon, CapTooltip} from '@capillarytech/cap-ui-library';
|
|
16
15
|
import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
|
|
17
16
|
import LabelHOC from '@capillarytech/cap-ui-library/assets/HOCs/ComponentWithLabelHOC';
|
|
18
|
-
import { createStructuredSelector } from 'reselect';
|
|
19
17
|
import { CAP_SPACE_12, CAP_SPACE_08, FONT_COLOR_05, FONT_COLOR_04 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
20
18
|
import TemplatePreview from '../TemplatePreview';
|
|
21
19
|
import TagList from '../../v2Containers/TagList';
|
|
@@ -26,13 +24,13 @@ import EDMEditor from "../Edmeditor";
|
|
|
26
24
|
import BeeEditor from '../../v2Containers/BeeEditor';
|
|
27
25
|
import CustomPopOver from '../CustomPopOver';
|
|
28
26
|
import messages from './messages';
|
|
29
|
-
import { selectCurrentOrgDetails } from "../../v2Containers/Cap/selectors";
|
|
30
27
|
import './_formBuilder.scss';
|
|
31
28
|
import {updateCharCount, checkUnicode} from "../../utils/smsCharCountV2";
|
|
32
|
-
import { SMS, LINE
|
|
29
|
+
import { SMS, LINE } from '../../v2Containers/CreativesContainer/constants';
|
|
33
30
|
import { validateIfTagClosed } from '../../utils/tagValidations';
|
|
34
31
|
import globalMessages from '../../v2Containers/Cap/messages';
|
|
35
32
|
import { convert } from 'html-to-text';
|
|
33
|
+
import { createNewFile } from '../../utils/common';
|
|
36
34
|
const TabPane = Tabs.TabPane;
|
|
37
35
|
const {Column} = Table;
|
|
38
36
|
const {TextArea} = CapInput;
|
|
@@ -2164,13 +2162,14 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2164
2162
|
e.preventDefault();
|
|
2165
2163
|
}
|
|
2166
2164
|
const _URL = window.URL || window.webkitURL;
|
|
2167
|
-
const
|
|
2165
|
+
const tempFile = files[0];
|
|
2168
2166
|
if (val.supportedExtensions) {
|
|
2169
2167
|
const allowedExtensions = /(\.bmp|\.jpeg|\.png|\.gif|\.jpg)$/i;
|
|
2170
|
-
if (!allowedExtensions.exec(
|
|
2171
|
-
this.callChildEvent({
|
|
2168
|
+
if (!allowedExtensions.exec(tempFile?.name)) {
|
|
2169
|
+
this.callChildEvent({tempFile, type: 'wrong file'}, val, val.submitAction);
|
|
2172
2170
|
}
|
|
2173
2171
|
}
|
|
2172
|
+
const file = createNewFile(tempFile);
|
|
2174
2173
|
const img = new Image();
|
|
2175
2174
|
img.src = _URL.createObjectURL(file);
|
|
2176
2175
|
img.onload = () => {
|
|
@@ -2281,12 +2280,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2281
2280
|
const messageContent = isVersionEnable ? formData[`${currentTab - 1}`][val.id] : formData[val.id];
|
|
2282
2281
|
const { MISSING_TAG_ERROR, UNSUPPORTED_TAG_ERROR, TAG_BRACKET_COUNT_MISMATCH_ERROR } = errorMessageForTags;
|
|
2283
2282
|
const { formatMessage } = this.props.intl;
|
|
2284
|
-
|
|
2285
|
-
const { accessibleFeatures = [] } = this.props.currentOrgDetails || {};
|
|
2286
|
-
const hasAiSuggestionsEnabled = accessibleFeatures.includes(
|
|
2287
|
-
ENABLE_AI_SUGGESTIONS
|
|
2288
|
-
);
|
|
2289
|
-
|
|
2290
2283
|
let errorMessageText = false;
|
|
2291
2284
|
switch (errorType) {
|
|
2292
2285
|
case MISSING_TAG_ERROR:
|
|
@@ -2322,16 +2315,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2322
2315
|
disabled={val.disabled}
|
|
2323
2316
|
cols={cols}
|
|
2324
2317
|
/>
|
|
2325
|
-
{this.props.schema.channel === "SMS" && this.props.fetchAiSuggestions && hasAiSuggestionsEnabled && (
|
|
2326
|
-
<CapAiSuggestions
|
|
2327
|
-
style={{ bottom: "1rem" }}
|
|
2328
|
-
text={messageContent || ""}
|
|
2329
|
-
setText={(x) => {
|
|
2330
|
-
this.updateFormData(x, val);
|
|
2331
|
-
}}
|
|
2332
|
-
getCompletions={this.props.fetchAiSuggestions}
|
|
2333
|
-
/>
|
|
2334
|
-
)}
|
|
2335
2318
|
</CapColumn>
|
|
2336
2319
|
);
|
|
2337
2320
|
}
|
|
@@ -3636,12 +3619,7 @@ FormBuilder.propTypes = {
|
|
|
3636
3619
|
setDrawerVisibility: PropTypes.bool,
|
|
3637
3620
|
capDrawerContent: PropTypes.array,
|
|
3638
3621
|
isFullMode: PropTypes.bool,
|
|
3639
|
-
fetchAiSuggestions: PropTypes.func,
|
|
3640
|
-
currentOrgDetails: PropTypes.object,
|
|
3641
|
-
};
|
|
3642
3622
|
|
|
3643
|
-
|
|
3644
|
-
currentOrgDetails: selectCurrentOrgDetails(),
|
|
3645
|
-
});
|
|
3623
|
+
};
|
|
3646
3624
|
|
|
3647
|
-
export default
|
|
3625
|
+
export default injectIntl(FormBuilder);
|
|
@@ -8,6 +8,7 @@ export const GET_SIDEBAR_FAILURE = 'app/App/GET_SIDEBAR_FAILURE';
|
|
|
8
8
|
|
|
9
9
|
export const getTopbarMenuDataValue = () => ([
|
|
10
10
|
{ label: <FormattedMessage {...globalMessages.campaigns} />, link: '/campaigns/ui/list', key: 'campaigns' },
|
|
11
|
+
{ label: <FormattedMessage {...globalMessages.journeys} />, link: '/journeys/ui', key: 'journeys' },
|
|
11
12
|
{ label: <FormattedMessage {...globalMessages.audience} />, link: '/audience-manager/list', key: 'audience' },
|
|
12
13
|
{ label: <FormattedMessage {...globalMessages.incentive} />, link: '/coupons/ui/', key: 'incentive' },
|
|
13
14
|
{ label: <FormattedMessage {...globalMessages.creatives} />, link: '/creatives/ui/v2', key: 'creatives' },
|
|
@@ -231,16 +231,18 @@ export class Gallery extends React.Component { // eslint-disable-line react/pref
|
|
|
231
231
|
const _URL = window.URL || window.webkitURL;
|
|
232
232
|
for (const file in files) {
|
|
233
233
|
if (files.hasOwnProperty(file)) {
|
|
234
|
+
const tempFile = files[file];
|
|
235
|
+
const uploadFile = commonUtil.createNewFile(tempFile);
|
|
234
236
|
const img = new Image();
|
|
235
237
|
const that = this;
|
|
236
|
-
img.src = _URL.createObjectURL(
|
|
238
|
+
img.src = _URL.createObjectURL(uploadFile);
|
|
237
239
|
img.onload = function () {
|
|
238
240
|
const fileParams = {
|
|
239
241
|
width: this.width,
|
|
240
242
|
height: this.height,
|
|
241
243
|
isGeneratePreview: true,
|
|
242
244
|
};
|
|
243
|
-
that.props.actions.uploadAsset(
|
|
245
|
+
that.props.actions.uploadAsset(uploadFile, 'image', fileParams);
|
|
244
246
|
};
|
|
245
247
|
}
|
|
246
248
|
}
|
|
@@ -307,6 +309,10 @@ export class Gallery extends React.Component { // eslint-disable-line react/pref
|
|
|
307
309
|
const currentChannel = 'gallery';
|
|
308
310
|
const { searchLoader, searchText } = this.state;
|
|
309
311
|
const cardDataList = templates?.length ? _.map(templates, (template) => {
|
|
312
|
+
const nameParts = template.name.split('.');
|
|
313
|
+
if (encodeURIComponent(decodeURIComponent(nameParts[0])) === nameParts[0]) {
|
|
314
|
+
template.name = `${decodeURIComponent(nameParts[0])}.${nameParts[1]}`;
|
|
315
|
+
}
|
|
310
316
|
const templateData =
|
|
311
317
|
{
|
|
312
318
|
key: `${currentChannel}-card-${template.name}`,
|
|
@@ -390,9 +396,21 @@ export class Gallery extends React.Component { // eslint-disable-line react/pref
|
|
|
390
396
|
const by = commonUtil.getUserNameById(parseInt(this.state.selectedAsset.updatedBy, 10), commonUtil.getMergedUserList(this.props.Gallery.userList));
|
|
391
397
|
const width = this.state.selectedAsset.metaInfo.width;
|
|
392
398
|
const height = this.state.selectedAsset.metaInfo.height;
|
|
399
|
+
const nameParts = this.state.selectedAsset.name.split('.');
|
|
400
|
+
console.log(this.state.selectedAsset);
|
|
401
|
+
console.log(nameParts);
|
|
402
|
+
let updatedTitle = this.state.selectedAsset.name;
|
|
403
|
+
console.log(nameParts[0]);
|
|
404
|
+
try {
|
|
405
|
+
if (encodeURIComponent(decodeURIComponent(nameParts[0])) === nameParts[0]) {
|
|
406
|
+
updatedTitle = `${decodeURIComponent(nameParts[0])}.${nameParts[1]}`;
|
|
407
|
+
}
|
|
408
|
+
} catch (error) {
|
|
409
|
+
console.log('Error decoding the string:', error);
|
|
410
|
+
}
|
|
393
411
|
const slideboxHeader = (<div>
|
|
394
412
|
<CapHeader
|
|
395
|
-
title={
|
|
413
|
+
title={updatedTitle}
|
|
396
414
|
description={<FormattedMessage
|
|
397
415
|
{...messages.lastUpdated}
|
|
398
416
|
values={{on, by }}
|
|
@@ -80,7 +80,7 @@ export default defineMessages({
|
|
|
80
80
|
},
|
|
81
81
|
assetUploadFailed: {
|
|
82
82
|
id: 'creatives.containersV2.Assets.Gallery.assetUploadFailed',
|
|
83
|
-
defaultMessage: 'Image
|
|
83
|
+
defaultMessage: 'Image upload failed',
|
|
84
84
|
},
|
|
85
85
|
assetDeleteSuccess: {
|
|
86
86
|
id: 'creatives.containersV2.Assets.Gallery.assetDeleteSuccess',
|
|
@@ -24,6 +24,10 @@ export default defineMessages({
|
|
|
24
24
|
id: 'creatives.containersV2.Cap.campaigns',
|
|
25
25
|
defaultMessage: 'Campaigns',
|
|
26
26
|
},
|
|
27
|
+
"journeys": {
|
|
28
|
+
id: 'creatives.containersV2.Cap.journeys',
|
|
29
|
+
defaultMessage: 'Journeys',
|
|
30
|
+
},
|
|
27
31
|
"loyalty": {
|
|
28
32
|
id: 'creatives.containersV2.Cap.loyalty',
|
|
29
33
|
defaultMessage: 'Loyalty',
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from '../../v2Containers/App/constants';
|
|
14
14
|
// import {makeSelectOrgId} from './selectors';
|
|
15
15
|
|
|
16
|
-
function* authorize(user) {
|
|
16
|
+
export function* authorize(user) {
|
|
17
17
|
try {
|
|
18
18
|
const res = yield call(Api.authorize, user);
|
|
19
19
|
yield call(LocalStorage.saveItem, 'token', res.token);
|
|
@@ -41,13 +41,14 @@ function* switchOrg({orgID}) {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
function* loginFlow() {
|
|
45
|
-
|
|
44
|
+
export function* loginFlow() {
|
|
45
|
+
let condition = true;
|
|
46
46
|
while (condition) {
|
|
47
47
|
const { user } = yield take(types.LOGIN_REQUEST);
|
|
48
48
|
const task = yield fork(authorize, user);
|
|
49
49
|
const action = yield take([types.LOGOUT_REQUEST_V2, types.LOGIN_FAILURE]);
|
|
50
50
|
if (action.type === types.LOGOUT_REQUEST_V2) {
|
|
51
|
+
condition = false;
|
|
51
52
|
yield cancel(task);
|
|
52
53
|
}
|
|
53
54
|
// yield call(LocalStorage.clearItem, 'token');
|