@capillarytech/creatives-library 6.13.4 → 6.13.6

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 (57) hide show
  1. package/app.js +5 -2
  2. package/components/FormBuilder/index.js +6 -2
  3. package/containers/Ebill/index.js +3 -0
  4. package/containers/Email/index.js +16 -8
  5. package/containers/Sms/Create/index.js +2 -1
  6. package/index.js +1 -8
  7. package/package.json +2 -2
  8. package/reducers.js +0 -2
  9. package/routes.js +1 -7
  10. package/services/api.js +0 -6
  11. package/utils/ignoredErrorMessages.js +4 -0
  12. package/v2Components/FormBuilder/index.js +5 -3
  13. package/v2Components/TemplatePreview/_templatePreview.scss +2 -8
  14. package/v2Components/TemplatePreview/index.js +17 -100
  15. package/v2Containers/Cap/index.js +30 -9
  16. package/v2Containers/CreativesContainer/SlideBoxContent.js +2 -65
  17. package/v2Containers/CreativesContainer/constants.js +0 -2
  18. package/v2Containers/CreativesContainer/index.js +2 -29
  19. package/v2Containers/Line/Create/_lineCreate.scss +64 -0
  20. package/v2Containers/Line/Create/actions.js +94 -0
  21. package/v2Containers/Line/Create/constants.js +43 -0
  22. package/v2Containers/Line/Create/index.js +1112 -0
  23. package/v2Containers/Line/Create/initialSchema.js +378 -0
  24. package/v2Containers/Line/Create/messages.js +229 -0
  25. package/v2Containers/Line/Create/reducer.js +99 -0
  26. package/v2Containers/Line/Create/sagas.js +113 -0
  27. package/v2Containers/Line/Create/selectors.js +30 -0
  28. package/v2Containers/Line/CreateWrapper/constants.js +2 -0
  29. package/v2Containers/Line/CreateWrapper/index.js +117 -0
  30. package/v2Containers/Line/CreateWrapper/messages.js +55 -0
  31. package/v2Containers/Line/Edit/_lineEdit.scss +23 -0
  32. package/v2Containers/Line/Edit/actions.js +79 -0
  33. package/v2Containers/Line/Edit/constants.js +27 -0
  34. package/v2Containers/Line/Edit/index.js +1051 -0
  35. package/v2Containers/Line/Edit/messages.js +173 -0
  36. package/v2Containers/Line/Edit/reducer.js +83 -0
  37. package/v2Containers/Line/Edit/sagas.js +81 -0
  38. package/v2Containers/Line/Edit/selectors.js +29 -0
  39. package/v2Containers/Line/Edit/tests/actions.test.js +18 -0
  40. package/v2Containers/Line/Edit/tests/index.test.js +10 -0
  41. package/v2Containers/Line/Edit/tests/reducer.test.js +9 -0
  42. package/v2Containers/Line/Edit/tests/sagas.test.js +15 -0
  43. package/v2Containers/Line/Edit/tests/selectors.test.js +10 -0
  44. package/v2Containers/Templates/_templates.scss +0 -57
  45. package/v2Containers/Templates/index.js +5 -54
  46. package/v2Containers/TemplatesV2/index.js +1 -12
  47. package/v2Containers/TemplatesV2/messages.js +0 -4
  48. package/v2Containers/WeChat/MapTemplates/index.js +1 -1
  49. package/assets/viber.png +0 -0
  50. package/v2Containers/Viber/_viber.scss +0 -3
  51. package/v2Containers/Viber/actions.js +0 -74
  52. package/v2Containers/Viber/constants.js +0 -30
  53. package/v2Containers/Viber/index.js +0 -700
  54. package/v2Containers/Viber/messages.js +0 -137
  55. package/v2Containers/Viber/reducer.js +0 -84
  56. package/v2Containers/Viber/sagas.js +0 -107
  57. package/v2Containers/Viber/selectors.js +0 -21
@@ -2,7 +2,6 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import styled from 'styled-components';
4
4
  import get from 'lodash/get';
5
- import cloneDeep from 'lodash/cloneDeep';
6
5
  import TemplatesV2 from '../TemplatesV2';
7
6
  import TemplatePreview from '../../v2Components/TemplatePreview';
8
7
  import SmsCreate from '../Sms/Create';
@@ -19,7 +18,6 @@ import CallTask from '../CallTask';
19
18
  import MobliPushEdit from '../MobilePush/Edit';
20
19
  import * as constants from './constants';
21
20
  import LineContainer from '../Line/Container';
22
- import Viber from '../Viber';
23
21
  const CreativesWrapper = styled.div`
24
22
  .ant-popover,
25
23
  .ant-notification,
@@ -34,6 +32,7 @@ function getWechatTemplateType(mode, templateData, weChatTemplateType = '') {
34
32
  }
35
33
  return weChatTemplateType;
36
34
  }
35
+
37
36
  const getLineType = ({
38
37
  slidBoxContent,
39
38
  channel,
@@ -71,22 +70,6 @@ const getLineType = ({
71
70
  }
72
71
  return {};
73
72
  };
74
- const getViber = ({
75
- slidBoxContent,
76
- channel,
77
- isFullMode,
78
- templateData,
79
- }) => {
80
- if ((channel === constants.VIBER || (slidBoxContent === 'editTemplate' && templateData && templateData.type === constants.VIBER)) && slidBoxContent !== 'templates') {
81
- const isCreate = slidBoxContent === 'createTemplate';
82
- const isEdit = slidBoxContent === 'editTemplate';
83
- return {
84
- isCreate,
85
- isEdit,
86
- };
87
- }
88
- return {};
89
- };
90
73
 
91
74
  function SlideBoxContent(props) {
92
75
  const {
@@ -152,15 +135,6 @@ function SlideBoxContent(props) {
152
135
  isFullMode,
153
136
  templateData,
154
137
  });
155
- const {isCreate: isCreateViber = false,
156
- isEdit: isEditViber = false } = getViber({
157
- slidBoxContent,
158
- channel,
159
- isFullMode,
160
- templateData,
161
- });
162
-
163
-
164
138
  const isCreateSms = slidBoxContent === 'createTemplate' && channel === constants.SMS;
165
139
  const isCreateMPush = slidBoxContent === 'createTemplate' && channel === constants.MOBILE_PUSH;
166
140
  const isCreateCallTask = slidBoxContent === 'createTemplate' && channel === constants.CALL_TASK;
@@ -182,7 +156,7 @@ function SlideBoxContent(props) {
182
156
  isEditEmailWithId = slidBoxContent === 'editTemplate' && channel === constants.EMAIL && templateData._id;
183
157
  isEmailEditWithContent = slidBoxContent === 'editTemplate' && channel === constants.EMAIL && !templateData._id;
184
158
  isEditFacebook = slidBoxContent === 'editTemplate' && channel === constants.FACEBOOK;
185
- isPreview = slidBoxContent === 'preview' && (channel === constants.SMS || channel === constants.LINE || channel === constants.VIBER);
159
+ isPreview = slidBoxContent === 'preview' && (channel === constants.SMS || channel === constants.LINE);
186
160
  isEmailPreview = slidBoxContent === 'preview' && channel === constants.EMAIL;
187
161
  isMpushPreview = slidBoxContent === 'preview' && channel === constants.MOBILE_PUSH;
188
162
  }
@@ -249,16 +223,6 @@ function SlideBoxContent(props) {
249
223
  return previewContent;
250
224
  });
251
225
  }
252
- case constants.VIBER: {
253
- const template = cloneDeep(templateDataObject);
254
- const { text = "", imageURL = "", buttonText = "" } = get(template, 'versions.base.content.viber', {});
255
- template.content = {
256
- messageContent: text,
257
- imageURL,
258
- buttonText,
259
- };
260
- return template.content;
261
- }
262
226
  default:
263
227
  return get(templateDataObject, `versions.base.content`);
264
228
  }
@@ -536,33 +500,6 @@ function SlideBoxContent(props) {
536
500
  />
537
501
  )
538
502
  }
539
- {isCreateViber && (
540
- <Viber
541
- location={creativesLocationProps}
542
- onCreateComplete={onCreateComplete}
543
- isFullMode={isFullMode}
544
- handleClose={handleClose}
545
- isGetFormData={isGetFormData}
546
- getFormSubscriptionData={getFormData}
547
- onShowTemplates={onShowTemplates}
548
- templateData={templateData}
549
- createNew/>
550
- )}
551
-
552
- {isEditViber && <Viber
553
- location={creativesLocationProps}
554
- params={{
555
- id: templateData._id,
556
- }}
557
- onCreateComplete={onCreateComplete}
558
- isFullMode={isFullMode}
559
- handleClose={handleClose}
560
- isGetFormData={isGetFormData}
561
- getFormSubscriptionData={getFormData}
562
- onShowTemplates={onShowTemplates}
563
- templateData={templateData}
564
- createNew/> }
565
-
566
503
  </CreativesWrapper>
567
504
  );
568
505
  }
@@ -13,7 +13,5 @@ export const CALL_TASK = "CALL_TASK";
13
13
  export const MOBILE_PUSH = "MOBILEPUSH";
14
14
  export const WECHAT = "WECHAT";
15
15
  export const FACEBOOK = "FACEBOOK";
16
- export const VIBER = "VIBER";
17
-
18
16
  export const SHOW_CONTANER_LOADER = "app/CreativesContainer/SHOW_CONTANER_LOADER";
19
17
  export const HIDE_CONTAINER_LOADER = "app/CreativesContainer/HIDE_CONTAINER_LOADER";
@@ -247,24 +247,6 @@ class Creatives extends React.Component {
247
247
  };
248
248
  break;
249
249
  }
250
- case constants.VIBER: {
251
- const { messageBody, isDefault } = templateData;
252
- const viberContent = JSON.parse(messageBody || '{}').messages || [{}];
253
- creativesTemplateData = {
254
- type: constants.VIBER,
255
- isDefault,
256
- edit: true,
257
- name: "Campaign message VIBER content",
258
- versions: {
259
- base: {
260
- content: {
261
- viber: viberContent,
262
- },
263
- },
264
- },
265
- };
266
- break;
267
- }
268
250
  default:
269
251
  break;
270
252
  }
@@ -350,15 +332,6 @@ class Creatives extends React.Component {
350
332
  };
351
333
  }
352
334
  break;
353
- case constants.VIBER:
354
- if (template.value) {
355
- const { versions } = template.value;
356
- templateData = {
357
- channel,
358
- messageBody: JSON.stringify(versions.base.content),
359
- };
360
- }
361
- break;
362
335
  default:
363
336
  break;
364
337
  }
@@ -473,8 +446,8 @@ class Creatives extends React.Component {
473
446
  }
474
447
  }
475
448
 
476
- const isLineViberChannel = templateData && [constants.LINE, constants.VIBER].includes(templateData);
477
- if ([constants.LINE, constants.VIBER].includes(channel) || isLineViberChannel) {
449
+ const isLineChannel = templateData && templateData.type === constants.LINE;
450
+ if (channel === constants.LINE || isLineChannel) {
478
451
  showFooter = false;
479
452
  }
480
453
 
@@ -0,0 +1,64 @@
1
+ @import '~@capillarytech/cap-ui-library/styles/_variables.scss';
2
+
3
+ .line-row{
4
+ margin-bottom: 16px;
5
+ }
6
+ .slidebox-content-container {
7
+ overflow-x: hidden;
8
+ }
9
+ .line-image {
10
+ position: relative;
11
+ }
12
+ .image-container {
13
+ display: flex;
14
+ & > div {
15
+ min-width: 516px;
16
+ }
17
+ border-radius: 5px;
18
+ .image-placeholder{
19
+ line-height: 150px;
20
+ }
21
+ img {
22
+ object-fit: cover;
23
+ max-width: 100%;
24
+ max-height: 100%;
25
+ height: auto !important;
26
+ width: auto !important;
27
+ }
28
+ }
29
+
30
+ .pagination-container.gallery-upload {
31
+ height: calc(100vh - 60px);
32
+
33
+ .cap-custom-card-list-col {
34
+ max-width: 156px;
35
+ max-height: 156px;
36
+ display: inline-block;
37
+ margin-left: $CAP_SPACE_04;
38
+ margin-right: $CAP_SPACE_04;
39
+ }
40
+
41
+ .ant-card-body {
42
+ padding-top: 0;
43
+
44
+ .ant-card-meta-description img {
45
+ height: 80px;
46
+ width: auto;
47
+ }
48
+ }
49
+ }
50
+
51
+ .gallery-image {
52
+ height: 156px;
53
+ width: 156px;
54
+ border-radius: 4px;
55
+ margin: 3px;
56
+ }
57
+
58
+ .sms-text {
59
+ img {
60
+ display: block;
61
+ max-width: 100%;
62
+ object-fit: cover;
63
+ }
64
+ }
@@ -0,0 +1,94 @@
1
+ /*
2
+ *
3
+ * Create actions
4
+ *
5
+ */
6
+
7
+ import * as types from './constants';
8
+
9
+ export function createTemplate(template, callback) {
10
+ console.log('action trigereed createtemplate');
11
+ return {
12
+ type: types.CREATE_TEMPLATE_REQUEST,
13
+ template,
14
+ callback,
15
+ };
16
+ }
17
+
18
+ export function clearCreateResponse() {
19
+ console.log('clearCreateResponse');
20
+ return {
21
+ type: types.CLEAR_CREATE_RESPONSE_REQUEST,
22
+ };
23
+ }
24
+
25
+ export function defaultAction() {
26
+ return {
27
+ type: types.DEFAULT_ACTION,
28
+ };
29
+ }
30
+
31
+ export function uploadAsset(file, assetType, fileParams) {
32
+ return {
33
+ type: types.UPLOAD_ASSET_REQUEST,
34
+ file,
35
+ assetType,
36
+ fileParams,
37
+ };
38
+ }
39
+
40
+ export function clearAsset() {
41
+ return {
42
+ type: types.CLEAR_ASSET,
43
+ };
44
+ }
45
+
46
+
47
+ // FOR EDIT
48
+
49
+
50
+ export function editTemplate(template, callback) {
51
+ console.log('action trigereed editTemplate line @@@');
52
+ return {
53
+ type: types.EDIT_TEMPLATE_REQUEST,
54
+ template,
55
+ callback,
56
+ };
57
+ }
58
+
59
+ export function getTemplateDetails(id) {
60
+ console.log('getting template line @@@', id);
61
+ return {
62
+ type: types.GET_TEMPLATE_DETAILS_REQUEST,
63
+ id,
64
+ channel: 'LINE',
65
+ };
66
+ }
67
+
68
+ export function clearEditResponse() {
69
+ console.log('clearEditResponse');
70
+ return {
71
+ type: types.CLEAR_EDIT_RESPONSE_REQUEST,
72
+ };
73
+ }
74
+
75
+ export function clearData() {
76
+ return {
77
+ type: types.CLEAR_DATA,
78
+ };
79
+ }
80
+
81
+ export function getLineTemplatesList(channel, queryParams) {
82
+ return {
83
+ type: types.GET_LINE_TEMPLATES_LIST_REQUEST,
84
+ channel,
85
+ queryParams,
86
+ };
87
+ }
88
+
89
+ export function setSelectedTemplate(templateData) {
90
+ return {
91
+ type: types.SET_SELECTED_TEMPLATE,
92
+ data: templateData,
93
+ };
94
+ }
@@ -0,0 +1,43 @@
1
+ /*
2
+ *
3
+ * Create constants
4
+ *
5
+ */
6
+
7
+ export const DEFAULT_ACTION = 'app/Create/DEFAULT_ACTION';
8
+
9
+
10
+ export const CREATE_TEMPLATE_REQUEST = 'app/v2Containers/Line/Create/CREATE_TEMPLATE_REQUEST';
11
+ export const CREATE_TEMPLATE_SUCCESS = 'app/v2Containers/Line/Create/CREATE_TEMPLATE_SUCCESS';
12
+ export const CREATE_TEMPLATE_FAILURE = 'app/v2Containers/Line/Create/CREATE_TEMPLATE_FAILURE';
13
+ export const UPLOAD_ASSET_REQUEST = 'app/v2Containers/Line/Create/UPLOAD_ASSET_REQUEST';
14
+ export const UPLOAD_ASSET_SUCCESS = 'app/v2Containers/Line/Create/UPLOAD_ASSET_SUCCESS';
15
+ export const UPLOAD_ASSET_FAILURE = 'app/v2Containers/Line/Create/UPLOAD_ASSET_FAILURE';
16
+ export const CLEAR_ASSET = 'app/v2Containers/Line/Create/CLEAR_ASSET';
17
+
18
+ export const CLEAR_CREATE_RESPONSE_REQUEST = 'app/v2Containers/Line/Create/CLEAR_CREATE_RESPONSE_REQUEST';
19
+ export const CLEAR_CREATE_RESPONSE_SUCCESS = 'app/v2Containers/Line/Create/CLEAR_CREATE_RESPONSE_SUCCESS';
20
+ export const CLEAR_CREATE_RESPONSE_FAILURE = 'app/v2Containers/Line/Create/CLEAR_CREATE_RESPONSE_FAILURE';
21
+
22
+ export const LINE_IMG_HEIGHT = 400;
23
+ export const LINE_IMG_WIDTH = 300;
24
+ export const LINE_IMG_SIZE = 30000000;
25
+
26
+
27
+ // edit
28
+
29
+ export const GET_TEMPLATE_DETAILS_REQUEST = 'app/v2Containers/line/Edit/GET_TEMPLATE_DETAILS_REQUEST';
30
+ export const GET_TEMPLATE_DETAILS_SUCCESS = 'app/v2Containers/line/Edit/GET_TEMPLATE_DETAILS_SUCCESS';
31
+ export const GET_TEMPLATE_DETAILS_FAILURE = 'app/v2Containers/line/Edit/GET_TEMPLATE_DETAILS_FAILURE';
32
+
33
+ export const EDIT_TEMPLATE_REQUEST = 'app/v2Containers/line/Edit/EDIT_TEMPLATE_REQUEST';
34
+ export const EDIT_TEMPLATE_SUCCESS = 'app/v2Containers/line/Edit/EDIT_TEMPLATE_SUCCESS';
35
+ export const EDIT_TEMPLATE_FAILURE = 'app/v2Containers/line/Edit/EDIT_TEMPLATE_FAILURE';
36
+
37
+ export const CLEAR_EDIT_RESPONSE_REQUEST = 'app/v2Containers/line/Edit/CLEAR_EDIT_RESPONSE_REQUEST';
38
+ export const CLEAR_DATA = 'app/v2Containers/Line/Edit/CLEAR_DATA';
39
+ export const SET_SELECTED_TEMPLATE = 'app/v2Containers/Line/Edit/SET_SELECTED_TEMPLATE';
40
+
41
+ export const GET_LINE_TEMPLATES_LIST_REQUEST = 'app/v2Containers/Line/GET_LINE_TEMPLATES_LIST_REQUEST';
42
+ export const GET_LINE_TEMPLATES_LIST_SUCCESS = 'app/v2Containers/Line/GET_LINE_TEMPLATES_LIST_SUCCESS';
43
+ export const GET_LINE_TEMPLATES_LIST_FAILURE = 'app/v2Containers/Line/GET_LINE_TEMPLATES_LIST_FAILURE';