@capillarytech/creatives-library 6.9.2 → 6.9.5
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/components/CapTagList/index.js +1 -1
- package/components/Edmeditor/index.js +1 -1
- package/components/FormBuilder/index.js +1 -0
- package/components/TemplatePreview/_templatePreview.scss +6 -0
- package/components/TemplatePreview/index.js +35 -28
- package/config/app.js +1 -1
- package/containers/TagList/index.js +4 -5
- package/index.html +0 -5
- package/package.json +1 -2
- package/services/api.js +1 -16
- package/v2Components/CapTagList/index.js +26 -55
- package/v2Components/Carousel/index.js +120 -0
- package/v2Components/Carousel/style.scss +40 -0
- package/v2Components/CmsTemplatesComponent/index.js +4 -4
- package/v2Components/Edmeditor/index.js +1 -1
- package/v2Components/EmailPreview/_emailPreview.scss +2 -2
- package/v2Components/FormBuilder/index.js +43 -79
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +151 -151
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +33 -33
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/tests/index.test.js +10 -10
- package/v2Components/TemplatePreview/_templatePreview.scss +1 -0
- package/v2Components/TemplatePreview/assets/images/androidPushMessage.svg +44 -44
- package/v2Components/TemplatePreview/assets/images/home-screen-android.svg +21 -21
- package/v2Components/TemplatePreview/assets/images/home-screen-ios.svg +16 -16
- package/v2Components/TemplatePreview/assets/images/iPhonePushMessage.svg +134 -134
- package/v2Components/TemplatePreview/assets/images/mobile.svg +23 -23
- package/v2Components/TemplatePreview/assets/images/sms_mobile_android.svg +22 -22
- package/v2Components/TemplatePreview/assets/images/user-icon.svg +18 -18
- package/v2Components/TemplatePreview/assets/images/wechat-home-screen-android.svg +21 -21
- package/v2Components/TemplatePreview/assets/images/wechat-mobile.svg +77 -77
- package/v2Components/TemplatePreview/assets/images/wechat_mobile_android.svg +20 -20
- package/v2Components/TemplatePreview/index.js +36 -29
- package/v2Components/TemplatePreview/tests/index.test.js +10 -10
- package/v2Containers/CreativesContainer/SlideBoxContent.js +7 -1
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +51 -51
- package/v2Containers/CreativesContainer/actions.js +27 -27
- package/v2Containers/CreativesContainer/constants.js +17 -17
- package/v2Containers/CreativesContainer/index.js +2 -7
- package/v2Containers/CreativesContainer/index.scss +44 -44
- package/v2Containers/CreativesContainer/messages.js +305 -305
- package/v2Containers/CreativesContainer/reducer.js +29 -29
- package/v2Containers/CreativesContainer/sagas.js +11 -11
- package/v2Containers/CreativesContainer/selectors.js +30 -30
- package/v2Containers/CreativesContainer/tests/actions.test.js +18 -18
- package/v2Containers/CreativesContainer/tests/index.test.js +10 -10
- package/v2Containers/CreativesContainer/tests/reducer.test.js +9 -9
- package/v2Containers/CreativesContainer/tests/sagas.test.js +15 -15
- package/v2Containers/CreativesContainer/tests/selectors.test.js +10 -10
- package/v2Containers/Email/constants.js +0 -1
- package/v2Containers/Email/index.js +115 -169
- package/v2Containers/Email/initialSchema.js +3 -18
- package/v2Containers/Email/sagas.js +2 -2
- package/v2Containers/Email/selectors.js +0 -5
- package/v2Containers/EmailWrapper/index.js +3 -19
- package/v2Containers/Line/Container/Image/index.js +21 -19
- package/v2Containers/Line/Container/ImageCarousel/Content.js +554 -0
- package/v2Containers/Line/Container/ImageCarousel/constants.js +10 -0
- package/v2Containers/Line/Container/ImageCarousel/index.js +526 -0
- package/v2Containers/Line/Container/ImageCarousel/messages.js +178 -0
- package/v2Containers/Line/Container/ImageCarousel/style.js +61 -0
- package/v2Containers/Line/Container/ImageMap/constants.js +2 -1
- package/v2Containers/Line/Container/ImageMap/index.js +31 -6
- package/v2Containers/Line/Container/ImageMap/messages.js +12 -0
- package/v2Containers/Line/Container/Wrapper/index.js +5 -1
- package/v2Containers/Line/Container/Wrapper/messages.js +4 -0
- package/v2Containers/Line/Container/Wrapper/utils.js +15 -16
- package/v2Containers/Line/Container/_lineCreate.scss +2 -2
- package/v2Containers/Line/Container/actions.js +4 -2
- package/v2Containers/Line/Container/constants.js +3 -0
- package/v2Containers/Line/Container/index.js +49 -11
- package/v2Containers/Line/Container/reducer.js +2 -2
- package/v2Containers/Line/Container/sagas.js +2 -2
- package/v2Containers/Line/Container/style.js +2 -1
- package/v2Containers/TagList/index.js +0 -6
- package/v2Containers/Templates/_templates.scss +9 -0
- package/v2Containers/Templates/actions.js +117 -122
- package/v2Containers/Templates/constants.js +47 -49
- package/v2Containers/Templates/index.js +47 -36
- package/v2Containers/Templates/messages.js +4 -8
- package/v2Containers/Templates/reducer.js +145 -153
- package/v2Containers/Templates/sagas.js +179 -179
- package/v2Containers/Templates/selectors.js +1 -19
- package/v2Containers/Templates/tests/actions.test.js +18 -18
- package/v2Containers/Templates/tests/index.test.js +10 -10
- package/v2Containers/Templates/tests/reducer.test.js +9 -9
- package/v2Containers/Templates/tests/sagas.test.js +15 -15
- package/v2Containers/Templates/tests/selectors.test.js +10 -10
- package/v2Containers/TemplatesV2/TemplatesV2.style.js +29 -29
- package/v2Containers/TemplatesV2/actions.js +16 -16
- package/v2Containers/TemplatesV2/constants.js +10 -10
- package/v2Containers/TemplatesV2/messages.js +61 -61
- package/v2Containers/TemplatesV2/selectors.js +25 -25
- package/v2Containers/TemplatesV2/tests/actions.test.js +18 -18
- package/v2Containers/TemplatesV2/tests/index.test.js +10 -10
- package/v2Containers/TemplatesV2/tests/reducer.test.js +9 -9
- package/v2Containers/TemplatesV2/tests/sagas.test.js +15 -15
- package/v2Containers/TemplatesV2/tests/selectors.test.js +10 -10
- package/v2Components/BeeEditor/index.js +0 -272
- package/v2Components/BeeEditor/index.scss +0 -11
- package/v2Components/BeeEditor/messages.js +0 -47
- package/v2Components/BeeEditor/tests/index.test.js +0 -10
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* Beeeditor
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
import React, { useEffect, useState, useRef, useCallback } from 'react';
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
|
-
import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
|
|
9
|
-
import TagList from '../../v2Containers/TagList';
|
|
10
|
-
import
|
|
11
|
-
{
|
|
12
|
-
CapModal,
|
|
13
|
-
CapButton,
|
|
14
|
-
CapInput,
|
|
15
|
-
CapSelect,
|
|
16
|
-
}
|
|
17
|
-
from '@capillarytech/cap-ui-library';
|
|
18
|
-
import messages from './messages';
|
|
19
|
-
import './index.scss';
|
|
20
|
-
|
|
21
|
-
function BeeEditor(props) {
|
|
22
|
-
const {
|
|
23
|
-
uid,
|
|
24
|
-
beeJson,
|
|
25
|
-
tokenData,
|
|
26
|
-
id,
|
|
27
|
-
location = {},
|
|
28
|
-
moduleFilterEnabled,
|
|
29
|
-
label,
|
|
30
|
-
className,
|
|
31
|
-
userLocale,
|
|
32
|
-
selectedOfferDetails,
|
|
33
|
-
tags,
|
|
34
|
-
injectedTags,
|
|
35
|
-
saveBeeInstance,
|
|
36
|
-
saveBeeData,
|
|
37
|
-
intl,
|
|
38
|
-
onContextChange,
|
|
39
|
-
} = props;
|
|
40
|
-
const {formatMessage} = intl;
|
|
41
|
-
const UNSUBSCRIBE = 'unsubscribe';
|
|
42
|
-
let beePluginInstance = null;
|
|
43
|
-
const categoryOptions = [];
|
|
44
|
-
const [visibleTaglist, setVisibleTaglist] = useState(false);
|
|
45
|
-
const [showRowMetaModal, setRowMetaModal] = useState(false);
|
|
46
|
-
const [selectedTag, setSelectedTag] = useState({});
|
|
47
|
-
const [rowMetaInfo, setRowMetaInfo] = useState({});
|
|
48
|
-
const [rowName, setRowName] = useState('');
|
|
49
|
-
const [rowTags, setRowTags] = useState('');
|
|
50
|
-
const [rowCategory, setRowCategory] = useState('');
|
|
51
|
-
|
|
52
|
-
const savedCallback = useRef();
|
|
53
|
-
const filteredTags = (tags || []).filter((obj) => obj.definition.value !== UNSUBSCRIBE);
|
|
54
|
-
let intervalTimer;
|
|
55
|
-
|
|
56
|
-
useEffect(() => {
|
|
57
|
-
savedCallback.current = Object.keys(selectedTag).length > 0 ? selectedTag : rowMetaInfo;
|
|
58
|
-
}, [selectedTag, rowMetaInfo]);
|
|
59
|
-
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
const beeConfig = {
|
|
62
|
-
uid,
|
|
63
|
-
container: 'bee-plugin-container',
|
|
64
|
-
rowsConfiguration: {
|
|
65
|
-
emptyRows: true,
|
|
66
|
-
defaultRows: true,
|
|
67
|
-
},
|
|
68
|
-
contentDialog: {
|
|
69
|
-
specialLinks: {
|
|
70
|
-
label: UNSUBSCRIBE,
|
|
71
|
-
handler(resolve) {
|
|
72
|
-
resolve({
|
|
73
|
-
type: 'custom',
|
|
74
|
-
label: UNSUBSCRIBE,
|
|
75
|
-
link: `{{${UNSUBSCRIBE}}}`,
|
|
76
|
-
});
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
mergeTags: {
|
|
80
|
-
label: 'search',
|
|
81
|
-
handler: async (resolve, reject) => {
|
|
82
|
-
await setVisibleTaglist(true);
|
|
83
|
-
const promise = new Promise((resolveP) => {
|
|
84
|
-
intervalTimer = setInterval(() => {
|
|
85
|
-
if ((savedCallback.current || {}).close === true) {
|
|
86
|
-
reject();
|
|
87
|
-
clearInterval(intervalTimer);
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
if (Object.keys(savedCallback.current || {}).length > 0) {
|
|
91
|
-
resolveP(savedCallback.current);
|
|
92
|
-
setSelectedTag({});
|
|
93
|
-
clearInterval(intervalTimer);
|
|
94
|
-
}
|
|
95
|
-
}, 2000);
|
|
96
|
-
});
|
|
97
|
-
const result = await promise;
|
|
98
|
-
resolve(result); // "done!"
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
saveRow: {
|
|
102
|
-
handler: async (resolve, reject, args) => {
|
|
103
|
-
await setRowMetaModal(true);
|
|
104
|
-
const promise = new Promise((resolveP) => {
|
|
105
|
-
intervalTimer = setInterval(() => {
|
|
106
|
-
if ((savedCallback.current || {}).close === true) {
|
|
107
|
-
reject();
|
|
108
|
-
clearInterval(intervalTimer);
|
|
109
|
-
setRowMetaInfo({});
|
|
110
|
-
setRowName('');
|
|
111
|
-
setRowTags('');
|
|
112
|
-
setRowCategory('');
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
if (Object.keys(savedCallback.current || {}).length > 0) {
|
|
116
|
-
const data = {...args, ...savedCallback.current};
|
|
117
|
-
resolveP(data);
|
|
118
|
-
}
|
|
119
|
-
}, 2000);
|
|
120
|
-
});
|
|
121
|
-
const result = await promise;
|
|
122
|
-
resolve(result); // "done!"
|
|
123
|
-
setRowMetaInfo({});
|
|
124
|
-
setRowName('');
|
|
125
|
-
setRowTags('');
|
|
126
|
-
setRowCategory('');
|
|
127
|
-
clearInterval(intervalTimer);
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
onSave: (jsonFile, htmlFile) => {
|
|
132
|
-
saveBeeData(jsonFile, htmlFile);
|
|
133
|
-
},
|
|
134
|
-
// will use this function on save row feature
|
|
135
|
-
onSaveRows: (jsonFile, htmlFile) => {
|
|
136
|
-
console.log('bee-plugin-container onSaveRows', jsonFile, htmlFile);
|
|
137
|
-
},
|
|
138
|
-
};
|
|
139
|
-
window.BeePlugin.create(tokenData, beeConfig, (instance) => {
|
|
140
|
-
beePluginInstance = instance;
|
|
141
|
-
const parseJson = JSON.parse(beeJson);
|
|
142
|
-
beePluginInstance.start(parseJson);
|
|
143
|
-
saveBeeInstance(beePluginInstance);
|
|
144
|
-
});
|
|
145
|
-
return () => clearInterval(intervalTimer);
|
|
146
|
-
}, []);
|
|
147
|
-
|
|
148
|
-
const onTagSelect = (result) => {
|
|
149
|
-
const msg = {
|
|
150
|
-
name: result,
|
|
151
|
-
value: `{{${result}}}`,
|
|
152
|
-
};
|
|
153
|
-
setSelectedTag(msg);
|
|
154
|
-
setVisibleTaglist(false);
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
const onCancelTagList = () => {
|
|
158
|
-
setVisibleTaglist(false);
|
|
159
|
-
setSelectedTag({close: true});
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
const handleCancel = () => {
|
|
163
|
-
setRowMetaModal(false);
|
|
164
|
-
setRowMetaInfo({close: true});
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
const handleOk = () => {
|
|
168
|
-
const rowInfo = {};
|
|
169
|
-
if (rowTags !== '') {
|
|
170
|
-
rowInfo.tags = rowTags;
|
|
171
|
-
}
|
|
172
|
-
if (rowCategory !== '') {
|
|
173
|
-
rowInfo.category = rowCategory;
|
|
174
|
-
}
|
|
175
|
-
setRowMetaInfo({
|
|
176
|
-
name: rowName,
|
|
177
|
-
...rowInfo,
|
|
178
|
-
});
|
|
179
|
-
setRowMetaModal(false);
|
|
180
|
-
};
|
|
181
|
-
const isDisableSave = () => rowName === '';
|
|
182
|
-
|
|
183
|
-
const onRowChange = useCallback((e) => {
|
|
184
|
-
setRowName(e.target.value);
|
|
185
|
-
});
|
|
186
|
-
// will use this function on save row feature
|
|
187
|
-
const onChangeCategoy = (e) => {
|
|
188
|
-
console.log('onChangeCategoy', e);
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
const onTagChange = (e) => {
|
|
192
|
-
setRowTags(e.target.value);
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
const contentSection = <>
|
|
196
|
-
<CapInput
|
|
197
|
-
label={<FormattedMessage {...messages.rowName} />}
|
|
198
|
-
placeholder={formatMessage(messages.rowPlaceHolder)}
|
|
199
|
-
onChange={onRowChange}
|
|
200
|
-
value={rowName}
|
|
201
|
-
maxLength={50}
|
|
202
|
-
style={{ width: '324px', paddingBottom: '16px' }}
|
|
203
|
-
/>
|
|
204
|
-
<CapSelect
|
|
205
|
-
label="Category"
|
|
206
|
-
style={{ width: 250, paddingBottom: '16px'}}
|
|
207
|
-
options={categoryOptions}
|
|
208
|
-
selectPlaceholder={formatMessage(messages.select)}
|
|
209
|
-
placeholder={
|
|
210
|
-
<FormattedMessage {...messages.selectCategoyPlaceholder} />
|
|
211
|
-
}
|
|
212
|
-
onChange={onChangeCategoy}
|
|
213
|
-
/>
|
|
214
|
-
<CapInput
|
|
215
|
-
label={<FormattedMessage {...messages.tags} />}
|
|
216
|
-
placeholder={formatMessage(messages.tagPlaceHolder)}
|
|
217
|
-
onChange={onTagChange}
|
|
218
|
-
value={rowTags}
|
|
219
|
-
maxLength={50}
|
|
220
|
-
style={{ width: '324px', paddingBottom: '16px'}}
|
|
221
|
-
/>
|
|
222
|
-
</>;
|
|
223
|
-
return (
|
|
224
|
-
<>
|
|
225
|
-
<div id="bee-plugin-container" style={{ height: '500px'}}>
|
|
226
|
-
</div>
|
|
227
|
-
<TagList
|
|
228
|
-
moduleFilterEnabled={moduleFilterEnabled}
|
|
229
|
-
label={label}
|
|
230
|
-
onTagSelect={onTagSelect}
|
|
231
|
-
location={location}
|
|
232
|
-
tags={filteredTags}
|
|
233
|
-
injectedTags={injectedTags}
|
|
234
|
-
className={className}
|
|
235
|
-
id={id}
|
|
236
|
-
userLocale={userLocale}
|
|
237
|
-
selectedOfferDetails={selectedOfferDetails}
|
|
238
|
-
visibleTaglist={visibleTaglist}
|
|
239
|
-
hidePopover
|
|
240
|
-
modalProps={{
|
|
241
|
-
onCancel: onCancelTagList,
|
|
242
|
-
style: { left: 135, top: 250 },
|
|
243
|
-
className: "bee-editor-tag-list",
|
|
244
|
-
}}
|
|
245
|
-
onContextChange={onContextChange}
|
|
246
|
-
/>
|
|
247
|
-
<CapModal
|
|
248
|
-
visible={showRowMetaModal}
|
|
249
|
-
onCancel={handleCancel}
|
|
250
|
-
title={formatMessage(messages.customRows)}
|
|
251
|
-
footer={[
|
|
252
|
-
<CapButton key="back" onClick={handleCancel}>{formatMessage(messages.cancel)}</CapButton>,
|
|
253
|
-
<CapButton key="submit" type="primary" id="delete-version" onClick={handleOk} disabled={isDisableSave()}>
|
|
254
|
-
{formatMessage(messages.save)}
|
|
255
|
-
</CapButton>,
|
|
256
|
-
]}
|
|
257
|
-
>
|
|
258
|
-
{contentSection}
|
|
259
|
-
</CapModal>
|
|
260
|
-
</>
|
|
261
|
-
);
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
BeeEditor.propTypes = {
|
|
265
|
-
beeJson: PropTypes.object.isRequired,
|
|
266
|
-
tokenData: PropTypes.object.isRequired,
|
|
267
|
-
uid: PropTypes.string.isRequired,
|
|
268
|
-
showTagsPopover: PropTypes.func.isRequired,
|
|
269
|
-
intl: intlShape.isRequired,
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
export default injectIntl(BeeEditor);
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* BeeEditor Messages
|
|
3
|
-
*
|
|
4
|
-
* This contains all the text for the BeeEditor component.
|
|
5
|
-
*/
|
|
6
|
-
import { defineMessages } from 'react-intl';
|
|
7
|
-
|
|
8
|
-
const prefix = 'creatives.componentsV2.BeeEditor';
|
|
9
|
-
|
|
10
|
-
export default defineMessages({
|
|
11
|
-
cancel: {
|
|
12
|
-
id: `${prefix}.cancel`,
|
|
13
|
-
defaultMessage: 'Cancel',
|
|
14
|
-
},
|
|
15
|
-
save: {
|
|
16
|
-
id: `${prefix}.save`,
|
|
17
|
-
defaultMessage: 'Save',
|
|
18
|
-
},
|
|
19
|
-
rowPlaceHolder: {
|
|
20
|
-
id: `${prefix}.rowPlaceHolder`,
|
|
21
|
-
defaultMessage: 'Enter Row name',
|
|
22
|
-
},
|
|
23
|
-
rowName: {
|
|
24
|
-
id: `${prefix}.rowName`,
|
|
25
|
-
defaultMessage: 'Row name',
|
|
26
|
-
},
|
|
27
|
-
select: {
|
|
28
|
-
id: `${prefix}.select`,
|
|
29
|
-
defaultMessage: 'Select',
|
|
30
|
-
},
|
|
31
|
-
customRows: {
|
|
32
|
-
id: `${prefix}.customRows`,
|
|
33
|
-
defaultMessage: 'Custom rows',
|
|
34
|
-
},
|
|
35
|
-
selectCategoyPlaceholder: {
|
|
36
|
-
id: `${prefix}.selectCategoyPlaceholder`,
|
|
37
|
-
defaultMessage: 'Select category',
|
|
38
|
-
},
|
|
39
|
-
tags: {
|
|
40
|
-
id: `${prefix}.tags`,
|
|
41
|
-
defaultMessage: 'Tags (optional)',
|
|
42
|
-
},
|
|
43
|
-
tagPlaceHolder: {
|
|
44
|
-
id: `${prefix}.tagPlaceHolder`,
|
|
45
|
-
defaultMessage: 'Enter tags',
|
|
46
|
-
},
|
|
47
|
-
});
|