@capillarytech/creatives-library 7.8.0 → 7.9.0
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 +5 -1
- package/components/FormBuilder/index.js +2 -2
- package/containers/Email/index.js +8 -3
- package/containers/MobilePush/Create/index.js +2 -2
- package/containers/MobilePush/Edit/index.js +2 -2
- package/containers/WeChat/MapTemplates/index.js +15 -3
- package/package.json +1 -1
- package/services/api.js +20 -5
- package/translations/en.json +113 -2
- package/translations/zh.json +112 -1
- package/utils/gtmTrackers/gtmEvents/creativeDetails.js +6 -2
- package/utils/gtmTrackers/index.js +8 -4
- package/v2Components/CapImageUpload/index.js +14 -8
- package/v2Components/FormBuilder/index.js +10 -1
- package/v2Components/NavigationBar/index.js +63 -29
- package/v2Components/NavigationBar/messages.js +5 -0
- package/v2Components/TemplatePreview/assets/images/mobile.svg +24 -0
- package/v2Containers/App/constants.js +23 -3
- package/v2Containers/Cap/actions.js +2 -2
- package/v2Containers/Cap/constants.js +3 -2
- package/v2Containers/Cap/index.js +31 -18
- package/v2Containers/Cap/messages.js +8 -0
- package/v2Containers/Cap/sagas.js +18 -6
- package/v2Containers/CapFacebookPreview/constants.js +4 -0
- package/v2Containers/CapFacebookPreview/index.js +92 -67
- package/v2Containers/CapFacebookPreview/reducer.js +19 -10
- package/v2Containers/CreativesContainer/SlideBoxContent.js +2 -0
- package/v2Containers/CreativesContainer/index.js +80 -2
- package/v2Containers/Facebook/Advertisement/index.js +2 -2
- package/v2Containers/Facebook/Advertisement/index.scss +1 -1
- package/v2Containers/Facebook/index.js +15 -4
- package/v2Containers/Line/Container/Drawer/index.js +1 -1
- package/v2Containers/Line/Create/_lineCreate.scss +64 -0
- package/v2Containers/Line/Create/actions.js +94 -0
- package/v2Containers/Line/Create/constants.js +43 -0
- package/v2Containers/Line/Create/index.js +1132 -0
- package/v2Containers/Line/Create/initialSchema.js +378 -0
- package/v2Containers/Line/Create/messages.js +229 -0
- package/v2Containers/Line/Create/reducer.js +99 -0
- package/v2Containers/Line/Create/sagas.js +113 -0
- package/v2Containers/Line/Create/selectors.js +30 -0
- package/v2Containers/Line/CreateWrapper/constants.js +2 -0
- package/v2Containers/Line/CreateWrapper/index.js +117 -0
- package/v2Containers/Line/CreateWrapper/messages.js +55 -0
- package/v2Containers/Line/Edit/_lineEdit.scss +23 -0
- package/v2Containers/Line/Edit/actions.js +79 -0
- package/v2Containers/Line/Edit/constants.js +27 -0
- package/v2Containers/Line/Edit/index.js +1051 -0
- package/v2Containers/Line/Edit/messages.js +173 -0
- package/v2Containers/Line/Edit/reducer.js +83 -0
- package/v2Containers/Line/Edit/sagas.js +81 -0
- package/v2Containers/Line/Edit/selectors.js +29 -0
- package/v2Containers/Line/Edit/tests/actions.test.js +18 -0
- package/v2Containers/Line/Edit/tests/index.test.js +10 -0
- package/v2Containers/Line/Edit/tests/reducer.test.js +9 -0
- package/v2Containers/Line/Edit/tests/sagas.test.js +15 -0
- package/v2Containers/Line/Edit/tests/selectors.test.js +10 -0
- package/v2Containers/MobilePush/Edit/index.js +2 -2
- package/v2Containers/MobilepushWrapper/index.js +1 -1
- package/v2Containers/Templates/_templates.scss +4 -2
- package/v2Containers/Templates/index.js +5 -2
- package/v2Containers/TemplatesV2/index.js +11 -3
- package/v2Containers/WeChat/MapTemplates/index.js +12 -2
|
@@ -5,13 +5,17 @@ const gtmEvents = require.context('./gtmEvents', true, /\.js$/, 'lazy');
|
|
|
5
5
|
export const gtmPush = (eventType, eventObject) => {
|
|
6
6
|
try {
|
|
7
7
|
gtmEvents(`./${eventType}.js`)
|
|
8
|
-
.then(event => {
|
|
8
|
+
.then((event) => {
|
|
9
9
|
event.default(eventObject);
|
|
10
10
|
})
|
|
11
|
-
.catch(err => {
|
|
12
|
-
|
|
11
|
+
.catch((err) => {
|
|
12
|
+
if (err) {
|
|
13
|
+
Bugsnag.notify(err);
|
|
14
|
+
}
|
|
13
15
|
});
|
|
14
16
|
} catch (e) {
|
|
15
|
-
|
|
17
|
+
if (e) {
|
|
18
|
+
Bugsnag.notify(e);
|
|
19
|
+
}
|
|
16
20
|
}
|
|
17
21
|
};
|
|
@@ -85,6 +85,12 @@ function CapImageUpload(props) {
|
|
|
85
85
|
};
|
|
86
86
|
submitAction({file, type: 'image', fileParams}, incorrectFile);
|
|
87
87
|
};
|
|
88
|
+
img.onerror = () => {
|
|
89
|
+
const fileParams = {
|
|
90
|
+
error: true,
|
|
91
|
+
};
|
|
92
|
+
submitAction({fileParams}, incorrectFile);
|
|
93
|
+
}
|
|
88
94
|
if (e) {
|
|
89
95
|
const event = e;
|
|
90
96
|
event.target.value = null;
|
|
@@ -93,13 +99,12 @@ function CapImageUpload(props) {
|
|
|
93
99
|
|
|
94
100
|
const submitAction = useCallback((data, incorrectFile) => {
|
|
95
101
|
const {
|
|
96
|
-
file
|
|
97
|
-
fileParams
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
if (incorrectFile || size > imgSize || height > imgHeight || width > imgWidth) {
|
|
102
|
+
file,
|
|
103
|
+
fileParams
|
|
104
|
+
} = data || {};
|
|
105
|
+
const { size } = file || {};
|
|
106
|
+
const { height, width, error } = fileParams || {};
|
|
107
|
+
if (incorrectFile || size > imgSize || height > imgHeight || width > imgWidth || error) {
|
|
103
108
|
updateImageErrorMessage(formatMessage(messages.imageIncorrectSize));
|
|
104
109
|
} else {
|
|
105
110
|
updateImageErrorMessage('');
|
|
@@ -166,6 +171,7 @@ function CapImageUpload(props) {
|
|
|
166
171
|
<CapUploader.CapDragger
|
|
167
172
|
customRequest={capUploaderCustomRequest}
|
|
168
173
|
className="form-builder-dragger"
|
|
174
|
+
showUploadList={!isImageError}
|
|
169
175
|
>
|
|
170
176
|
<CapHeading className="dragger-title" type="h7">
|
|
171
177
|
<FormattedMessage {...messages.dragAndDrop} />
|
|
@@ -198,7 +204,7 @@ function CapImageUpload(props) {
|
|
|
198
204
|
<FormattedMessage {...messages.imageReUpload} />
|
|
199
205
|
</CapButton>
|
|
200
206
|
);
|
|
201
|
-
}, []);
|
|
207
|
+
}, [isImageError]);
|
|
202
208
|
|
|
203
209
|
return (
|
|
204
210
|
<div style={style} className="cap-custom-image-upload">
|
|
@@ -2854,7 +2854,16 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2854
2854
|
name={val.name ? val.name : `${val.id}-name`}
|
|
2855
2855
|
disabled={val.disabled}
|
|
2856
2856
|
>
|
|
2857
|
-
{val.options.map((option, index) =>
|
|
2857
|
+
{val.options.map((option, index) => {
|
|
2858
|
+
const isMappedTemplateWechat = val.id === "template-redirect-options-radio";
|
|
2859
|
+
return (
|
|
2860
|
+
<CapRadio
|
|
2861
|
+
value={ isMappedTemplateWechat ? option.value : option }
|
|
2862
|
+
inductiveText={val.inductiveText && val.inductiveText[index]}>{ isMappedTemplateWechat ? option.label : option }
|
|
2863
|
+
</CapRadio>
|
|
2864
|
+
)
|
|
2865
|
+
}
|
|
2866
|
+
)}
|
|
2858
2867
|
|
|
2859
2868
|
</CapRadioGroup>
|
|
2860
2869
|
{/*{ifError ?*/}
|
|
@@ -10,11 +10,23 @@ import styled from 'styled-components';
|
|
|
10
10
|
import { isEmpty, forEach } from 'lodash';
|
|
11
11
|
import { loadItem } from 'services/localStorageApi';
|
|
12
12
|
import { intlShape, injectIntl } from 'react-intl';
|
|
13
|
+
import { FONT_COLOR_04 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
13
14
|
import TopBar from '../TopBar';
|
|
14
15
|
import messages from './messages';
|
|
16
|
+
import { LOYALTY } from '../../v2Containers/App/constants';
|
|
17
|
+
import {
|
|
18
|
+
HELP_URL,
|
|
19
|
+
LOYALTY_HELP_URL,
|
|
20
|
+
} from '../../v2Containers/Cap/constants';
|
|
15
21
|
const PRODUCT_MASTERS = 'masters';
|
|
16
22
|
const EMBEDDED = 'embedded';
|
|
17
23
|
|
|
24
|
+
const AppWrapper = styled.div`
|
|
25
|
+
.navigation-setting-icon {
|
|
26
|
+
color: ${FONT_COLOR_04};
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
29
|
+
|
|
18
30
|
const CapWrapper = styled.div`
|
|
19
31
|
position: absolute;
|
|
20
32
|
padding: 0;
|
|
@@ -34,9 +46,37 @@ const ComponentWrapper = styled.div`
|
|
|
34
46
|
class NavigationBar extends React.Component {
|
|
35
47
|
constructor(props) {
|
|
36
48
|
super(props);
|
|
37
|
-
this.state =
|
|
38
|
-
|
|
39
|
-
|
|
49
|
+
this.state = this.initializeSelectedProduct();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
initializeSelectedProduct = () => {
|
|
53
|
+
const {location, intl: {formatMessage}} = this.props;
|
|
54
|
+
const { pathname } = location;
|
|
55
|
+
const parentModule = pathname.substring(pathname.lastIndexOf('/') + 1);
|
|
56
|
+
switch (parentModule) {
|
|
57
|
+
case LOYALTY:
|
|
58
|
+
return {
|
|
59
|
+
selectedProduct: formatMessage(messages.loyaltyProgram),
|
|
60
|
+
helpUrl: LOYALTY_HELP_URL,
|
|
61
|
+
settingsIcon: {
|
|
62
|
+
iconType: 'settings',
|
|
63
|
+
key: 'settings',
|
|
64
|
+
placement: 'bottomRight',
|
|
65
|
+
className: 'navigation-setting-icon',
|
|
66
|
+
toolTip: formatMessage(messages.noProductSetting),
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
default:
|
|
70
|
+
return {
|
|
71
|
+
selectedProduct: formatMessage(messages.selectedProductDefault),
|
|
72
|
+
helpUrl: HELP_URL,
|
|
73
|
+
settingsIcon: {
|
|
74
|
+
iconType: 'settings',
|
|
75
|
+
key: 'settings',
|
|
76
|
+
onClickHandler: this.onSettingsIconClick,
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
}
|
|
40
80
|
}
|
|
41
81
|
|
|
42
82
|
onOrgSettingsClick = () => {
|
|
@@ -57,7 +97,7 @@ class NavigationBar extends React.Component {
|
|
|
57
97
|
};
|
|
58
98
|
|
|
59
99
|
onHelpIconClick = () => {
|
|
60
|
-
const {
|
|
100
|
+
const {helpUrl} = this.state;
|
|
61
101
|
if (helpUrl) {
|
|
62
102
|
window.open(helpUrl, '_blank');
|
|
63
103
|
}
|
|
@@ -113,18 +153,17 @@ class NavigationBar extends React.Component {
|
|
|
113
153
|
return productsList;
|
|
114
154
|
};
|
|
115
155
|
|
|
116
|
-
getTopbarIcons = () =>
|
|
117
|
-
{
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
];
|
|
156
|
+
getTopbarIcons = () => {
|
|
157
|
+
const {settingsIcon} = this.state;
|
|
158
|
+
return [
|
|
159
|
+
{
|
|
160
|
+
iconType: 'help',
|
|
161
|
+
key: 'help',
|
|
162
|
+
onClickHandler: this.onHelpIconClick,
|
|
163
|
+
},
|
|
164
|
+
settingsIcon,
|
|
165
|
+
];
|
|
166
|
+
}
|
|
128
167
|
|
|
129
168
|
getDropdownMenu = () => {
|
|
130
169
|
const { formatMessage } = this.props.intl;
|
|
@@ -168,7 +207,6 @@ class NavigationBar extends React.Component {
|
|
|
168
207
|
topbarMenuData,
|
|
169
208
|
loggedIn,
|
|
170
209
|
type,
|
|
171
|
-
intl,
|
|
172
210
|
} = this.props;
|
|
173
211
|
const productsList = this.getProductsList();
|
|
174
212
|
const proxyOrgList = this.getProxyOrgList();
|
|
@@ -178,14 +216,11 @@ class NavigationBar extends React.Component {
|
|
|
178
216
|
const { selectedProduct } = this.state;
|
|
179
217
|
const customTopBarProps = {};
|
|
180
218
|
return (
|
|
181
|
-
<
|
|
219
|
+
<AppWrapper>
|
|
182
220
|
{loggedIn && type !== EMBEDDED &&
|
|
183
221
|
<TopBar
|
|
184
222
|
productsList={productsList}
|
|
185
|
-
selectedProduct={
|
|
186
|
-
selectedProduct ||
|
|
187
|
-
intl.formatMessage(messages.selectedProductDefault)
|
|
188
|
-
}
|
|
223
|
+
selectedProduct={selectedProduct}
|
|
189
224
|
handleProductChange={this.handleProductChange}
|
|
190
225
|
proxyOrgList={proxyOrgList}
|
|
191
226
|
selectedOrg={selectedOrg}
|
|
@@ -197,12 +232,12 @@ class NavigationBar extends React.Component {
|
|
|
197
232
|
{...customTopBarProps}
|
|
198
233
|
/>
|
|
199
234
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
</
|
|
235
|
+
<CapWrapper isEmbedded={type === EMBEDDED}>
|
|
236
|
+
<ComponentWrapper>
|
|
237
|
+
{React.Children.toArray(this.props.children)}
|
|
238
|
+
</ComponentWrapper>
|
|
239
|
+
</CapWrapper>
|
|
240
|
+
</AppWrapper>
|
|
206
241
|
);
|
|
207
242
|
}
|
|
208
243
|
}
|
|
@@ -214,7 +249,6 @@ NavigationBar.propTypes = {
|
|
|
214
249
|
changeOrg: PropTypes.func,
|
|
215
250
|
settingsUrl: PropTypes.string,
|
|
216
251
|
children: PropTypes.node,
|
|
217
|
-
helpUrl: PropTypes.string,
|
|
218
252
|
orgSettingsUrl: PropTypes.string,
|
|
219
253
|
loggedIn: PropTypes.bool,
|
|
220
254
|
intl: intlShape.isRequired,
|
|
@@ -57,4 +57,9 @@ export default defineMessages({
|
|
|
57
57
|
id: `${scope}.storeCare`,
|
|
58
58
|
defaultMessage: 'Store Care',
|
|
59
59
|
},
|
|
60
|
+
"noProductSetting": {
|
|
61
|
+
id: `${scope}.noProductSetting`,
|
|
62
|
+
defaultMessage:
|
|
63
|
+
'There are no product settings. Organisation settings are available under profile on the right.',
|
|
64
|
+
},
|
|
60
65
|
});
|