@capillarytech/creatives-library 3.8.7 → 3.8.8

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.
@@ -0,0 +1,378 @@
1
+ export const response = {
2
+ metaEntities: [
3
+ {
4
+ _id: "5b926d5aa77c585b698a5620",
5
+ type: "LAYOUT",
6
+ definition: {
7
+ module: "Campaigns",
8
+ channel: "LINE",
9
+ textSchema: {
10
+ standalone: {
11
+ sections: [
12
+ {
13
+ type: "parent",
14
+ childSections: [
15
+ {
16
+ type: "multicols",
17
+ width: 16,
18
+ inputFields: [
19
+ {
20
+ cols: [],
21
+ },
22
+ ],
23
+ actionFields: [],
24
+ },
25
+ {
26
+ type: "parent",
27
+ childSections: [
28
+ {
29
+ width: 16,
30
+ type: "parent",
31
+ childSections: [
32
+ {
33
+ type: "multicols",
34
+ inputFields: [
35
+ {
36
+ cols: [
37
+ {
38
+ id: "template-name",
39
+ placeholder: "",
40
+ type: "input",
41
+ label: "Message",
42
+ metaType: "text",
43
+ datatype: "string",
44
+ required: true,
45
+ fluid: true,
46
+ styling: "semantic",
47
+ order: 1,
48
+ width: 18,
49
+ customComponent: false,
50
+ standalone: true,
51
+ onlyDisplay: false,
52
+ errorMessage:
53
+ "",
54
+ supportedEvents: ["onChange"],
55
+ },
56
+ ],
57
+ },
58
+ ],
59
+ },
60
+ {
61
+ type: "multicols",
62
+ inputFields: [
63
+ {
64
+ rowClassName: "tag-container",
65
+ cols: [
66
+ {
67
+ style: {
68
+ marginBottom: "unset",
69
+ height: "24px",
70
+ },
71
+ width: 18,
72
+ id: "tagList",
73
+ label: "Add label",
74
+ className: "add-label",
75
+ type: "tag-list",
76
+ metaType: "List",
77
+ datatype: "select",
78
+ required: true,
79
+ fluid: true,
80
+ onlyDisplay: true,
81
+ styling: "semantic",
82
+ order: 1,
83
+ customComponent: true,
84
+ supportedEvents: ["onTagSelect"],
85
+ },
86
+ ],
87
+ },
88
+ ],
89
+ },
90
+ {
91
+ type: "multicols",
92
+
93
+ inputFields: [
94
+ {
95
+ rowClassName: "line-message-content",
96
+ cols: [
97
+ {
98
+ id: "message-editor",
99
+ label: "Message",
100
+ type: "textarea",
101
+ metaType: "text",
102
+ datatype: "string",
103
+ style: { marginBottom: "16px" },
104
+ required: true,
105
+ errorMessage:
106
+ "",
107
+ placeholder:
108
+ "",
109
+ fluid: true,
110
+ styling: "semantic",
111
+ onlyDisplay: false,
112
+ width: 18,
113
+ autosize: true,
114
+ autosizeParams: {
115
+ maxRows: 18,
116
+ minRows: 3,
117
+ },
118
+ order: 2,
119
+ customComponent: true,
120
+ supportedEvents: ["onChange"],
121
+ },
122
+ ],
123
+ },
124
+ {
125
+ rowClassName: "sms-count-container",
126
+ rowStyle: {
127
+ bottom: "8px",
128
+ fontSize: "12px",
129
+ },
130
+ cols: [
131
+ {
132
+ id: "sms-count",
133
+ type: "div",
134
+ props: { type: "label3" },
135
+ onlyDisplay: true,
136
+ metaType: "label",
137
+ value: "",
138
+ primitive: true,
139
+ width: 18,
140
+ style: {
141
+ float: "right",
142
+ },
143
+ },
144
+ ],
145
+ },
146
+ ],
147
+ actionFields: [],
148
+ },
149
+ ],
150
+ },
151
+ {
152
+ width: 6,
153
+ type: "multicols",
154
+ offset: 1,
155
+
156
+ inputFields: [
157
+ {
158
+ cols: [
159
+ {
160
+ id: "line-preview",
161
+ type: "line-preview",
162
+ customComponent: true,
163
+ customStyling: {
164
+ padding: "0",
165
+ },
166
+ metaType: "preview",
167
+ required: true,
168
+ fluid: true,
169
+ styling: "semantic",
170
+ order: 1,
171
+ onlyDisplay: true,
172
+ offset: 7,
173
+ channel: "LINE",
174
+ charCounterEnabled: true,
175
+ },
176
+ ],
177
+ },
178
+ ],
179
+ },
180
+ ],
181
+ },
182
+ {
183
+ type: "multicols",
184
+ inputFields: [
185
+ {
186
+ rowClassName: "creatives-sms-footer",
187
+ cols: [
188
+ {
189
+ id: "save-button",
190
+ metaType: "submit-button",
191
+ colStyle: { marginRight: "16px" },
192
+ type: "button",
193
+ buttonType: "primary",
194
+ value: "Save",
195
+ customComponent: false,
196
+ styling: "semantic",
197
+ order: 3,
198
+ fluid: true,
199
+ standalone: true,
200
+ onlyDisplay: true,
201
+ submitAction: "saveFormData",
202
+ supportedEvents: ["saveFormData"],
203
+ },
204
+ ],
205
+ },
206
+ ],
207
+ actionFields: [],
208
+ },
209
+ ],
210
+ },
211
+ ],
212
+ },
213
+ module: "Campaigns",
214
+ channel: "LINE",
215
+ },
216
+ imageSchema: {
217
+ standalone: {
218
+ sections: [
219
+ {
220
+ type: "parent",
221
+ childSections: [
222
+ {
223
+ type: "multicols",
224
+ width: 16,
225
+ inputFields: [
226
+ {
227
+ cols: [],
228
+ },
229
+ ],
230
+ actionFields: [],
231
+ },
232
+ {
233
+ type: "parent",
234
+
235
+ childSections: [
236
+ {
237
+ width: 16,
238
+ type: "parent",
239
+ childSections: [
240
+ {
241
+ type: "multicols",
242
+ inputFields: [
243
+ {
244
+ cols: [
245
+ {
246
+ id: "template-name",
247
+ placeholder: "",
248
+ type: "input",
249
+ label: "Message",
250
+ metaType: "text",
251
+ datatype: "string",
252
+ required: true,
253
+ fluid: true,
254
+ styling: "semantic",
255
+ order: 1,
256
+ width: 18,
257
+ customComponent: false,
258
+ standalone: true,
259
+ onlyDisplay: false,
260
+ errorMessage:
261
+ "",
262
+ supportedEvents: ["onChange"],
263
+ },
264
+ ],
265
+ },
266
+ ],
267
+ },
268
+ {
269
+ type: "multicols",
270
+
271
+ inputFields: [
272
+ {
273
+ rowClassName:
274
+ "mobile-push-row mobile-push-img line-image",
275
+ cols: [
276
+ {
277
+ id: "image-upload-line",
278
+ type: "upload",
279
+ showPreview: true,
280
+ previewProps: {
281
+ label: "",
282
+ inductiveText:
283
+ "",
284
+ errorMessage: "",
285
+ },
286
+ width: 22,
287
+ metaType: "text",
288
+ datatype: "string",
289
+ required: true,
290
+ fluid: true,
291
+ styling: "semantic",
292
+ order: 1,
293
+ style: {
294
+ marginTop: 36,
295
+ },
296
+ customComponent: true,
297
+ offset: 0,
298
+ submitAction: "onUpload",
299
+ supportedEvents: ["onUpload"],
300
+ },
301
+ ],
302
+ },
303
+ ],
304
+ actionFields: [],
305
+ },
306
+ ],
307
+ },
308
+ {
309
+ width: 6,
310
+ type: "multicols",
311
+ offset: 1,
312
+
313
+ inputFields: [
314
+ {
315
+ cols: [
316
+ {
317
+ id: "line-preview",
318
+ type: "line-preview",
319
+ customComponent: true,
320
+ customStyling: {
321
+ padding: "0",
322
+ },
323
+ metaType: "preview",
324
+ required: true,
325
+ fluid: true,
326
+ styling: "semantic",
327
+ order: 1,
328
+ onlyDisplay: true,
329
+ offset: 7,
330
+ channel: "LINE",
331
+ charCounterEnabled: true,
332
+ },
333
+ ],
334
+ },
335
+ ],
336
+ },
337
+ ],
338
+ },
339
+ {
340
+ type: "multicols",
341
+ inputFields: [
342
+ {
343
+ rowClassName: "creatives-sms-footer",
344
+ cols: [
345
+ {
346
+ id: "save-button",
347
+ metaType: "submit-button",
348
+ colStyle: { marginRight: "16px" },
349
+ type: "button",
350
+ buttonType: "primary",
351
+ value: "Save",
352
+ customComponent: false,
353
+ styling: "semantic",
354
+ order: 3,
355
+ fluid: true,
356
+ standalone: true,
357
+ onlyDisplay: true,
358
+ submitAction: "saveFormData",
359
+ supportedEvents: ["saveFormData"],
360
+ },
361
+ ],
362
+ },
363
+ ],
364
+ actionFields: [],
365
+ },
366
+ ],
367
+ },
368
+ ],
369
+ },
370
+ channel: "LINE",
371
+ module: "Campaigns",
372
+ type: "LAYOUT",
373
+ },
374
+ },
375
+ isActive: true,
376
+ },
377
+ ],
378
+ };
@@ -110,8 +110,8 @@ export default defineMessages({
110
110
  id: 'creatives.containersV2.Line.Create.uploadImage',
111
111
  defaultMessage: 'Upload image',
112
112
  },
113
- "Line Template Created Successfully": {
114
- id: 'creatives.containersV2.Line.Create.templateCreatedSuccessfully',
113
+ "lineTemplateCreatedSuccessfully": {
114
+ id: 'creatives.containersV2.Line.Create.lineTemplateCreatedSuccessfully',
115
115
  defaultMessage: 'Line template created successfully',
116
116
  },
117
117
  "Line Template Edited Successfully": {
@@ -182,4 +182,44 @@ export default defineMessages({
182
182
  id: 'creatives.containersV2.Line.Create.goBackTemporaryLost',
183
183
  defaultMessage: 'Do you really want to go back? All your temporary changes will be lost!',
184
184
  },
185
+ "Template content has unsupported/missing tags!": {
186
+ id: 'creatives.containers.Create.tagsErrorMessage',
187
+ defaultMessage: 'Message cannot be empty',
188
+ },
189
+ "imageGallery": {
190
+ id: 'creatives.containers.Create.imageGallery',
191
+ defaultMessage: 'Gallery',
192
+ },
193
+ "templatePlaceholder": {
194
+ id: 'creatives.containers.Create.templatePlaceholder',
195
+ defaultMessage: 'Enter template name',
196
+ },
197
+ "templateNameErrorPlaceholder": {
198
+ id: 'creatives.containers.Create.templateNameErrorPlaceholder',
199
+ defaultMessage: 'Template name cannot be empty.',
200
+ },
201
+ "templateAddTag": {
202
+ id: 'creatives.containers.Create.templateAddTag',
203
+ defaultMessage: 'Add tag',
204
+ },
205
+ "templateMessageError": {
206
+ id: 'creatives.containers.Create.templateMessageError',
207
+ defaultMessage: 'Template content cannot be empty!',
208
+ },
209
+ "templateMessagePlaceholder": {
210
+ id: 'creatives.containers.Create.templateMessagePlaceholder',
211
+ defaultMessage: 'Please input line template content.',
212
+ },
213
+ "templateMessagePreviewPropsLabel": {
214
+ id: 'creatives.containers.Create.templateMessagePreviewPropsLabel',
215
+ defaultMessage: 'Upload image content',
216
+ },
217
+ "templateMessagePreviewPropsError": {
218
+ id: 'creatives.containers.Create.templateMessagePreviewPropsError',
219
+ defaultMessage: 'Please upload image',
220
+ },
221
+ "templateMessagePreviewPropsInductiveText": {
222
+ id: 'creatives.containers.Create.templateMessagePreviewPropsInductiveText',
223
+ defaultMessage: 'The relevant image that complements the message context.',
224
+ },
185
225
  });
@@ -6,15 +6,18 @@ import * as Api from '../../../services/api';
6
6
  import * as types from './constants';
7
7
 
8
8
  // Individual exports for testing
9
- export function* createTemplate(template) {
9
+ export function* createTemplate({ template, callback }) {
10
10
  let errorMsg;
11
11
  try {
12
12
  console.log('inside line saga createTemplate@@@', template);
13
- const result = yield call(Api.createLineTemplate, template);
13
+ const result = yield call(Api.createLineTemplate, { template });
14
14
  if (result.message || result.status.code === 500) {
15
15
  errorMsg = result.message;
16
16
  }
17
17
  yield put({ type: types.CREATE_TEMPLATE_SUCCESS, data: result.response, statusCode: result.status ? result.status.code : '', errorMsg });
18
+ if (callback) {
19
+ callback();
20
+ }
18
21
  } catch (error) {
19
22
  yield put({ type: types.CREATE_TEMPLATE_FAILURE, error, errorMsg });
20
23
  }
@@ -43,15 +46,18 @@ function* watchUploadAsset() {
43
46
 
44
47
  // edit
45
48
 
46
- export function* editTemplate(template) {
49
+ export function* editTemplate({ template, callback }) {
47
50
  let errorMsg;
48
51
  try {
49
52
  console.log('saga editTemplate line', template);
50
- const result = yield call(Api.createLineTemplate, template);
53
+ const result = yield call(Api.createLineTemplate, {template});
51
54
  console.log('saga editTemplate success line', result);
52
55
  if (result.message || result.status.code === 500) {
53
56
  errorMsg = result.message;
54
57
  }
58
+ if (callback) {
59
+ callback();
60
+ }
55
61
  yield put({ type: types.EDIT_TEMPLATE_SUCCESS, data: result.response, statusCode: result.status ? result.status.code : '', errorMsg });
56
62
  } catch (error) {
57
63
  yield put({ type: types.EDIT_TEMPLATE_FAILURE, error, errorMsg });
@@ -4,8 +4,7 @@ import { createSelector } from 'reselect';
4
4
  * Direct selector to the create state domain
5
5
  */
6
6
  const selectLineDomain = () => (state) => state.get('templates');
7
- const selectLineMessageEditDomain = () => (state) => state.get('line');
8
- //const selectLineDuplicateDomain = () => (state) => state.get('line');
7
+ const selectLineMessageEditDomain = () => (state) => state.get('lineCreate');
9
8
 
10
9
  /**
11
10
  * Other specific selectors
@@ -0,0 +1,2 @@
1
+ export const TEXT = 'text';
2
+ export const IMAGE = 'image';
@@ -0,0 +1,114 @@
1
+ /*
2
+ *
3
+ * CreateLineWrapper
4
+ *
5
+ */
6
+ import React, {useState} from 'react';
7
+ import { injectIntl, FormattedMessage, intlShape } from 'react-intl';
8
+ import {CapRadioCard, CapLabel, CapButton} from '@capillarytech/cap-ui-library';
9
+ import ComponentWithLabelHOC from '@capillarytech/cap-ui-library/assets/HOCs/ComponentWithLabelHOC';
10
+ import styled from 'styled-components';
11
+ import { CAP_SPACE_04, CAP_SPACE_08, CAP_SPACE_16 } from '@capillarytech/cap-ui-library/styled/variables';
12
+ import messages from './messages';
13
+ import mapTemplateImage from "../../../assets/mapTemplate.png";
14
+ import lineImageTemplate from "../../../assets/lineImageTemplate.png";
15
+ import { TEXT, IMAGE } from './constants';
16
+ import LineCreate from '../Create';
17
+
18
+ const CapRadioCardWithLabel = ComponentWithLabelHOC(CapRadioCard);
19
+ const CardContainer = styled.div`
20
+ margin-top: ${CAP_SPACE_16};
21
+ .component-with-label-label{
22
+ margin-bottom: unset;
23
+ }
24
+ .ant-radio-group{
25
+ .ant-radio-button-wrapper{
26
+ &:first-child{
27
+ margin-left: unset;
28
+ margin-top: unset;
29
+ }
30
+ }
31
+
32
+ }
33
+ `;
34
+
35
+ const CreateLineWrapper = (props) => {
36
+ const { intl: { formatMessage } } = props;
37
+
38
+ const getModes = (modeList) => (
39
+ modeList.map(({ label, imageSrc, type, title }) => ({
40
+ title: <FormattedMessage {...messages[title]}/>,
41
+ content: (
42
+ <>
43
+ <CapLabel type="label1" style={{ paddingTop: CAP_SPACE_04, paddingBottom: CAP_SPACE_08 }}>
44
+ {formatMessage(messages[label])}
45
+ </CapLabel>
46
+ <img alt="" className="template-image" src={imageSrc} />
47
+ </>
48
+ ),
49
+ value: type,
50
+ }))
51
+ );
52
+
53
+ const modes = [
54
+ {
55
+ title: 'textTemplateTitle',
56
+ label: 'textTemplateDescription',
57
+ imageSrc: mapTemplateImage,
58
+ type: TEXT,
59
+ },
60
+ {
61
+ title: 'imageTemplateTitle',
62
+ label: 'imageTemplateDescription',
63
+ imageSrc: lineImageTemplate,
64
+ type: IMAGE,
65
+ },
66
+ ];
67
+
68
+ const [selectedLineTemplateOption, updateSelectedLineTemplateOption] = useState();
69
+ const [showOptions, onSelectContinue] = useState(true);
70
+
71
+ const onOptionSelect = (event) => updateSelectedLineTemplateOption(event.target.value);
72
+
73
+ if (showOptions) {
74
+ return (
75
+ <>
76
+ <CardContainer>
77
+ <CapRadioCardWithLabel
78
+ label={<FormattedMessage {...messages.templateType}/>}
79
+ panes={getModes(modes)}
80
+ cardHeight={"364px"}
81
+ onChange={onOptionSelect}
82
+ selected={selectedLineTemplateOption}
83
+ />
84
+ </CardContainer>
85
+ {
86
+ selectedLineTemplateOption && (
87
+ <CapButton
88
+ key="submit"
89
+ type="primary"
90
+ onClick={() => onSelectContinue(false)}
91
+ style={{marginTop: 10}}
92
+ >
93
+ <FormattedMessage {...messages.continue} />
94
+ </CapButton>
95
+ )
96
+ }
97
+ </>
98
+ );
99
+ }
100
+
101
+ return (
102
+ <LineCreate
103
+ {...props}
104
+ params={{mode: selectedLineTemplateOption}}
105
+ route={{name: selectedLineTemplateOption}}
106
+ />
107
+ );
108
+ };
109
+
110
+ CreateLineWrapper.propTypes = {
111
+ intl: intlShape.isRequired,
112
+ };
113
+
114
+ export default injectIntl(CreateLineWrapper);
@@ -0,0 +1,43 @@
1
+ /*
2
+ * Create Line Messages
3
+ *
4
+ * This contains all the text for the Create component.
5
+ */
6
+ import { defineMessages } from 'react-intl';
7
+
8
+ const prefix = 'creatives.containersV2.Line.CreateWrapper';
9
+
10
+ export default defineMessages({
11
+ "textTemplateTitle": {
12
+ id: `${prefix}.textTemplateTitle`,
13
+ defaultMessage: 'Text template',
14
+ },
15
+ "textTemplateDescription": {
16
+ id: `${prefix}.textTemplateDescription`,
17
+ defaultMessage: 'Used for announcing offers and transaction related information',
18
+ },
19
+ "imageTemplateTitle": {
20
+ id: `${prefix}.imageTemplateTitle`,
21
+ defaultMessage: 'Image/video template',
22
+ },
23
+ "imageTemplateDescription": {
24
+ id: `${prefix}.imageTemplateDescription`,
25
+ defaultMessage: 'Used for creating image or video content',
26
+ },
27
+ "hybridTemplateTitle": {
28
+ id: `${prefix}.hybridTemplateTitle`,
29
+ defaultMessage: 'Hybrid',
30
+ },
31
+ "hybridTemplateDescription": {
32
+ id: `${prefix}.hybridTemplateDescription`,
33
+ defaultMessage: 'Used to create combined text & image or video content',
34
+ },
35
+ "templateType": {
36
+ id: `${prefix}.templateType`,
37
+ defaultMessage: 'Select the type of content',
38
+ },
39
+ "continue": {
40
+ id: `${prefix}.continue`,
41
+ defaultMessage: 'Continue',
42
+ },
43
+ });
@@ -13,6 +13,24 @@
13
13
  &:nth-child(4n+4) { //every 4th child
14
14
  margin-right: unset;
15
15
  }
16
+
17
+ .LINE {
18
+ .ant-card-body {
19
+ background-color: $CAP_G09;
20
+ height: 320px;
21
+ }
22
+
23
+ &.no-image .ant-card-meta {
24
+ height: 276px;
25
+ background: $CAP_WHITE;
26
+ padding: $CAP_SPACE_16 $CAP_SPACE_12;
27
+
28
+ .ant-card-meta-description {
29
+ height: 250px;
30
+ word-wrap: break-word;
31
+ }
32
+ }
33
+ }
16
34
  }
17
35
  }
18
36
  }
@@ -361,7 +379,8 @@
361
379
  overflow: hidden;
362
380
  }
363
381
 
364
- .wechat-filters {
382
+ .wechat-filters,
383
+ .line-filters {
365
384
  width: 100%;
366
385
  padding-left: 12px;
367
386
  .ant-radio-button-wrapper {