@capillarytech/creatives-library 6.12.4 → 6.12.7
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/config/app.js +1 -1
- package/package.json +2 -2
- package/services/api.js +2 -3
- package/v2Components/FormBuilder/index.js +0 -8
- 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/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/tests/index.test.js +10 -10
- package/v2Containers/Cap/_cap.scss +6 -0
- package/v2Containers/Cap/constants.js +4 -0
- package/v2Containers/Cap/index.js +210 -6
- package/v2Containers/Cap/messages.js +41 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +6 -2
- package/v2Containers/CreativesContainer/actions.js +27 -27
- package/v2Containers/CreativesContainer/constants.js +17 -17
- package/v2Containers/CreativesContainer/index.js +5 -4
- 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/actions.js +2 -1
- package/v2Containers/Email/index.js +46 -30
- package/v2Containers/Email/sagas.js +2 -2
- 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/index.js +5 -6
- 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 -263
- package/v2Components/BeeEditor/index.scss +0 -11
- package/v2Components/BeeEditor/messages.js +0 -71
- package/v2Components/BeeEditor/tests/index.test.js +0 -10
- package/v2Containers/Line/Create/_lineCreate.scss +0 -64
- package/v2Containers/Line/Create/actions.js +0 -94
- package/v2Containers/Line/Create/constants.js +0 -43
- package/v2Containers/Line/Create/index.js +0 -1132
- package/v2Containers/Line/Create/initialSchema.js +0 -378
- package/v2Containers/Line/Create/messages.js +0 -229
- package/v2Containers/Line/Create/reducer.js +0 -99
- package/v2Containers/Line/Create/sagas.js +0 -113
- package/v2Containers/Line/Create/selectors.js +0 -30
- package/v2Containers/Line/CreateWrapper/constants.js +0 -2
- package/v2Containers/Line/CreateWrapper/index.js +0 -117
- package/v2Containers/Line/CreateWrapper/messages.js +0 -55
- package/v2Containers/Line/Edit/_lineEdit.scss +0 -23
- package/v2Containers/Line/Edit/actions.js +0 -79
- package/v2Containers/Line/Edit/constants.js +0 -27
- package/v2Containers/Line/Edit/index.js +0 -1051
- package/v2Containers/Line/Edit/messages.js +0 -173
- package/v2Containers/Line/Edit/reducer.js +0 -83
- package/v2Containers/Line/Edit/sagas.js +0 -81
- package/v2Containers/Line/Edit/selectors.js +0 -29
- package/v2Containers/Line/Edit/tests/actions.test.js +0 -18
- package/v2Containers/Line/Edit/tests/index.test.js +0 -10
- package/v2Containers/Line/Edit/tests/reducer.test.js +0 -9
- package/v2Containers/Line/Edit/tests/sagas.test.js +0 -15
- package/v2Containers/Line/Edit/tests/selectors.test.js +0 -10
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="220" height="472" viewBox="0 0 220 472">
|
|
2
|
-
<g fill="none" fill-rule="evenodd">
|
|
3
|
-
<rect width="220" height="472" fill="#101211" rx="26"/>
|
|
4
|
-
<rect width="202" height="404" x="9" y="36" fill="#F4F5F7" rx="9"/>
|
|
5
|
-
<rect width="182" height="136" x="19" y="112" fill="#F4F5F7" rx="17.5"/>
|
|
6
|
-
<path fill="#F4F5F7" d="M18 36h184c4.97 0 9 4.03 9 9v6H9v-6c0-4.97 4.03-9 9-9z"/>
|
|
7
|
-
<path fill="#F4F5F7" d="M9 51H211V82H9z" transform="matrix(1 0 0 -1 0 133)"/>
|
|
8
|
-
<rect width="52" height="5" x="84" y="14" fill="#2E2E2E" rx="2.5"/>
|
|
9
|
-
<rect width="52" height="5" x="84" y="455" fill="#2E2E2E" rx="2.5"/>
|
|
10
|
-
<circle cx="45.5" cy="19.5" r="5.5" fill="#2E2E2E"/>
|
|
11
|
-
<circle cx="65.5" cy="19.5" r="3.5" fill="#2E2E2E"/>
|
|
12
|
-
<text fill="#000" font-family="Roboto-Regular, Roboto" font-size="12" letter-spacing=".175">
|
|
13
|
-
<tspan x="49.5" y="71">Muji India</tspan>
|
|
14
|
-
</text>
|
|
15
|
-
<circle cx="199" cy="63" r="1" fill="#000"/>
|
|
16
|
-
<circle cx="199" cy="70" r="1" fill="#000"/>
|
|
17
|
-
<circle cx="199" cy="66.5" r="1" fill="#000"/>
|
|
18
|
-
<path fill="#000" d="M28 66c0 .279-.226.505-.505.505h-5.556l2.42 2.42c.198.197.198.518 0 .716-.198.198-.52.198-.718 0l-2.934-2.934c-.39-.39-.39-1.024 0-1.414l2.934-2.934c.198-.198.52-.198.718 0 .198.198.198.519 0 .717l-2.42 2.419h5.556c.279 0 .505.226.505.505z"/>
|
|
19
|
-
</g>
|
|
20
|
-
</svg>
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="220" height="472" viewBox="0 0 220 472">
|
|
2
|
+
<g fill="none" fill-rule="evenodd">
|
|
3
|
+
<rect width="220" height="472" fill="#101211" rx="26"/>
|
|
4
|
+
<rect width="202" height="404" x="9" y="36" fill="#F4F5F7" rx="9"/>
|
|
5
|
+
<rect width="182" height="136" x="19" y="112" fill="#F4F5F7" rx="17.5"/>
|
|
6
|
+
<path fill="#F4F5F7" d="M18 36h184c4.97 0 9 4.03 9 9v6H9v-6c0-4.97 4.03-9 9-9z"/>
|
|
7
|
+
<path fill="#F4F5F7" d="M9 51H211V82H9z" transform="matrix(1 0 0 -1 0 133)"/>
|
|
8
|
+
<rect width="52" height="5" x="84" y="14" fill="#2E2E2E" rx="2.5"/>
|
|
9
|
+
<rect width="52" height="5" x="84" y="455" fill="#2E2E2E" rx="2.5"/>
|
|
10
|
+
<circle cx="45.5" cy="19.5" r="5.5" fill="#2E2E2E"/>
|
|
11
|
+
<circle cx="65.5" cy="19.5" r="3.5" fill="#2E2E2E"/>
|
|
12
|
+
<text fill="#000" font-family="Roboto-Regular, Roboto" font-size="12" letter-spacing=".175">
|
|
13
|
+
<tspan x="49.5" y="71">Muji India</tspan>
|
|
14
|
+
</text>
|
|
15
|
+
<circle cx="199" cy="63" r="1" fill="#000"/>
|
|
16
|
+
<circle cx="199" cy="70" r="1" fill="#000"/>
|
|
17
|
+
<circle cx="199" cy="66.5" r="1" fill="#000"/>
|
|
18
|
+
<path fill="#000" d="M28 66c0 .279-.226.505-.505.505h-5.556l2.42 2.42c.198.197.198.518 0 .716-.198.198-.52.198-.718 0l-2.934-2.934c-.39-.39-.39-1.024 0-1.414l2.934-2.934c.198-.198.52-.198.718 0 .198.198.198.519 0 .717l-2.42 2.419h5.556c.279 0 .505.226.505.505z"/>
|
|
19
|
+
</g>
|
|
20
|
+
</svg>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
// import React from 'react';
|
|
2
|
-
// import { shallow } from 'enzyme';
|
|
3
|
-
|
|
4
|
-
// import TemplatePreview from '../index';
|
|
5
|
-
|
|
6
|
-
describe('<TemplatePreview />', () => {
|
|
7
|
-
it('Expect to have unit tests specified', () => {
|
|
8
|
-
expect(true).toEqual(false);
|
|
9
|
-
});
|
|
10
|
-
});
|
|
1
|
+
// import React from 'react';
|
|
2
|
+
// import { shallow } from 'enzyme';
|
|
3
|
+
|
|
4
|
+
// import TemplatePreview from '../index';
|
|
5
|
+
|
|
6
|
+
describe('<TemplatePreview />', () => {
|
|
7
|
+
it('Expect to have unit tests specified', () => {
|
|
8
|
+
expect(true).toEqual(false);
|
|
9
|
+
});
|
|
10
|
+
});
|
|
@@ -31,3 +31,7 @@ export const CLEAR_TOPBAR_MENU_DATA = 'creatives/cap/CLEAR_TOPBAR_MENU_DATA';
|
|
|
31
31
|
export const CAMPAIGN_SETTINGS_URL = '/creatives/settings/message';
|
|
32
32
|
export const ORG_SETTINGS_URL = '/org/index';
|
|
33
33
|
export const HELP_URL = 'https://support.capillarytech.com/en/support/solutions/4000007853';
|
|
34
|
+
|
|
35
|
+
export const ORG_REFRESH_SEC = 10;
|
|
36
|
+
export const ORG_CHANGED = 'ORG_CHANGED';
|
|
37
|
+
|
|
@@ -2,15 +2,15 @@ import PropTypes from 'prop-types';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import Helmet from 'react-helmet';
|
|
4
4
|
import { connect } from 'react-redux';
|
|
5
|
-
import {CapNotification} from '@capillarytech/cap-ui-library';
|
|
5
|
+
import { CapNotification, CapModal, CapSnackBar } from '@capillarytech/cap-ui-library';
|
|
6
6
|
import { bindActionCreators } from 'redux';
|
|
7
7
|
import styled from 'styled-components';
|
|
8
8
|
import { createStructuredSelector } from 'reselect';
|
|
9
9
|
import _ from 'lodash';
|
|
10
10
|
import moment from 'moment';
|
|
11
11
|
// import 'moment/locale/zh-cn';
|
|
12
|
-
import { GA } from '@capillarytech/cap-ui-utils';
|
|
13
|
-
import { injectIntl, FormattedMessage } from 'react-intl';
|
|
12
|
+
import { GA, multipleOrgSwitch, utilsSessionStorageApi } from '@capillarytech/cap-ui-utils';
|
|
13
|
+
import { injectIntl, FormattedMessage, intlShape, FormattedHTMLMessage } from 'react-intl';
|
|
14
14
|
import messages from './messages';
|
|
15
15
|
import { makeSelectAuthenticated, makeSelectUser } from './selectors';
|
|
16
16
|
import * as actions from './actions';
|
|
@@ -25,8 +25,24 @@ import {
|
|
|
25
25
|
HELP_URL,
|
|
26
26
|
ORG_SETTINGS_URL,
|
|
27
27
|
CAMPAIGN_SETTINGS_URL,
|
|
28
|
+
ORG_REFRESH_SEC,
|
|
29
|
+
ORG_CHANGED
|
|
28
30
|
} from './constants';
|
|
31
|
+
import './_cap.scss';
|
|
32
|
+
import { BugsnagClient } from '../../app';
|
|
33
|
+
|
|
29
34
|
const gtm = window.dataLayer || [];
|
|
35
|
+
const {
|
|
36
|
+
logNewTab,
|
|
37
|
+
getOrgNameFromId,
|
|
38
|
+
tabBeforeUnloadEventHandler,
|
|
39
|
+
utilsHandleStorageChange,
|
|
40
|
+
isMultipleTabsOpen,
|
|
41
|
+
} = multipleOrgSwitch;
|
|
42
|
+
const {
|
|
43
|
+
loadSessionItem,
|
|
44
|
+
saveSessionItem,
|
|
45
|
+
} = utilsSessionStorageApi;
|
|
30
46
|
|
|
31
47
|
const CapWrapper = styled.div`
|
|
32
48
|
margin: 0 auto;
|
|
@@ -45,6 +61,11 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
45
61
|
this.state = {
|
|
46
62
|
switchedOrg: false,
|
|
47
63
|
isCreativesAccessible: true,
|
|
64
|
+
refreshSeconds: ORG_REFRESH_SEC,
|
|
65
|
+
selectedOrgId: null,
|
|
66
|
+
showRefreshModal: false,
|
|
67
|
+
showOrgChangeModal: false,
|
|
68
|
+
localStorageOrgInfo: { oldValue: null, newValue: null },
|
|
48
69
|
};
|
|
49
70
|
this.changeOrg = this.changeOrg.bind(this);
|
|
50
71
|
this.logout = this.logout.bind(this);
|
|
@@ -85,6 +106,14 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
85
106
|
//locale = 'zh';
|
|
86
107
|
console.log('Setting final locale as', locale);
|
|
87
108
|
moment.locale(locale);
|
|
109
|
+
window.addEventListener('storage', this.handleStorageChange, false);
|
|
110
|
+
document.addEventListener(
|
|
111
|
+
'visibilitychange',
|
|
112
|
+
this.handleVisibilityChange,
|
|
113
|
+
false,
|
|
114
|
+
);
|
|
115
|
+
window.addEventListener('pageshow', this.tabOnloadEventHandler, false);
|
|
116
|
+
window.addEventListener('pagehide', tabBeforeUnloadEventHandler, false);
|
|
88
117
|
}
|
|
89
118
|
|
|
90
119
|
componentWillReceiveProps(nextProps) {
|
|
@@ -119,10 +148,41 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
119
148
|
}
|
|
120
149
|
}
|
|
121
150
|
|
|
151
|
+
componentDidUpdate(prevProps) {
|
|
152
|
+
if (
|
|
153
|
+
!(prevProps.Global.currentOrgDetails) &&
|
|
154
|
+
this.props.Global.currentOrgDetails &&
|
|
155
|
+
loadSessionItem(ORG_CHANGED)
|
|
156
|
+
) {
|
|
157
|
+
this.showOrgChangeSnackBar();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
122
161
|
componentWillUnmount() {
|
|
123
162
|
this.setState({ switchedOrg: false });
|
|
124
163
|
this.props.actions.clearTopbarMenuData();
|
|
164
|
+
window.removeEventListener('storage', this.handleStorageChange, false);
|
|
165
|
+
document.removeEventListener(
|
|
166
|
+
'visibilitychange',
|
|
167
|
+
this.handleVisibilityChange,
|
|
168
|
+
false,
|
|
169
|
+
);
|
|
170
|
+
window.removeEventListener(
|
|
171
|
+
'pageshow',
|
|
172
|
+
this.tabOnloadEventHandler,
|
|
173
|
+
false,
|
|
174
|
+
);
|
|
175
|
+
window.removeEventListener(
|
|
176
|
+
'pagehide',
|
|
177
|
+
tabBeforeUnloadEventHandler,
|
|
178
|
+
false,
|
|
179
|
+
);
|
|
125
180
|
}
|
|
181
|
+
|
|
182
|
+
tabOnloadEventHandler = () => {
|
|
183
|
+
logNewTab(BugsnagClient);
|
|
184
|
+
}
|
|
185
|
+
|
|
126
186
|
setDimensionData() {
|
|
127
187
|
const userGtmData = this.getUserGtmData();
|
|
128
188
|
Object.values(userGtmData).forEach((value, index) => {
|
|
@@ -158,6 +218,7 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
158
218
|
};
|
|
159
219
|
return map[locale];
|
|
160
220
|
}
|
|
221
|
+
|
|
161
222
|
handleRemoveMessage(messageIndex) {
|
|
162
223
|
this.props.actions.removeMessageFromQueue(messageIndex);
|
|
163
224
|
}
|
|
@@ -172,17 +233,157 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
172
233
|
this.props.actions.logout();
|
|
173
234
|
}
|
|
174
235
|
changeOrg(orgId) {
|
|
175
|
-
|
|
176
|
-
|
|
236
|
+
//display orgChangeModal if more than one tabs is open
|
|
237
|
+
if (isMultipleTabsOpen()) {
|
|
238
|
+
this.setState({
|
|
239
|
+
showOrgChangeModal: true,
|
|
240
|
+
selectedOrgId: orgId,
|
|
241
|
+
});
|
|
242
|
+
} else {
|
|
243
|
+
this.props.actions.changeOrg(orgId);
|
|
244
|
+
}
|
|
177
245
|
}
|
|
178
246
|
|
|
247
|
+
showOrgChangeSnackBar = () => {
|
|
248
|
+
saveSessionItem(ORG_CHANGED, false);
|
|
249
|
+
const {
|
|
250
|
+
Global: {
|
|
251
|
+
currentOrgDetails: {
|
|
252
|
+
basic_details: { name: currentOrgName } = {},
|
|
253
|
+
} = {},
|
|
254
|
+
} = {},
|
|
255
|
+
intl: { formatMessage } = {},
|
|
256
|
+
} = this.props;
|
|
257
|
+
CapSnackBar.warning({
|
|
258
|
+
content: (
|
|
259
|
+
<div>
|
|
260
|
+
{formatMessage(messages.orgChangedText)}
|
|
261
|
+
<b>
|
|
262
|
+
{formatMessage(messages.newOrgName, {
|
|
263
|
+
newOrgName: currentOrgName,
|
|
264
|
+
})}
|
|
265
|
+
</b>
|
|
266
|
+
</div>
|
|
267
|
+
),
|
|
268
|
+
showCloseIcon: true,
|
|
269
|
+
});
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
handleVisibilityChange = () => {
|
|
273
|
+
const activeDoc = document.hidden || false;
|
|
274
|
+
const { showRefreshModal, refreshSeconds } = this.state;
|
|
275
|
+
if (
|
|
276
|
+
activeDoc === false &&
|
|
277
|
+
showRefreshModal &&
|
|
278
|
+
refreshSeconds === ORG_REFRESH_SEC
|
|
279
|
+
) {
|
|
280
|
+
const timer = setInterval(() => {
|
|
281
|
+
this.setState(prevState => ({
|
|
282
|
+
refreshSeconds: prevState.refreshSeconds - 1,
|
|
283
|
+
}));
|
|
284
|
+
}, 1000);
|
|
285
|
+
setTimeout(() => {
|
|
286
|
+
clearInterval(timer);
|
|
287
|
+
saveSessionItem(ORG_CHANGED, true);
|
|
288
|
+
this.navigateToDashboard();
|
|
289
|
+
}, refreshSeconds * 1000);
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
handleStorageChange = (e) => {
|
|
294
|
+
const { oldValue, newValue } = e;
|
|
295
|
+
if (utilsHandleStorageChange(e, 'orgID')) {
|
|
296
|
+
const localStorageOrgInfo = { oldValue, newValue };
|
|
297
|
+
this.setState({ showRefreshModal: true, localStorageOrgInfo });
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
renderOrgRefreshModal = () => {
|
|
302
|
+
const {
|
|
303
|
+
localStorageOrgInfo: { oldValue: oldOrgId, newValue: newOrgId } = {},
|
|
304
|
+
showRefreshModal,
|
|
305
|
+
refreshSeconds,
|
|
306
|
+
} = this.state;
|
|
307
|
+
const {
|
|
308
|
+
Global: { user: { proxyOrgList } = {} } = {},
|
|
309
|
+
intl: { formatMessage } = {},
|
|
310
|
+
} = this.props;
|
|
311
|
+
const oldOrgName = getOrgNameFromId(Number(oldOrgId), proxyOrgList);
|
|
312
|
+
const newOrgName = getOrgNameFromId(Number(newOrgId), proxyOrgList);
|
|
313
|
+
const modalData = (
|
|
314
|
+
<CapModal
|
|
315
|
+
title={formatMessage(messages.orgRefreshHeading)}
|
|
316
|
+
visible={showRefreshModal}
|
|
317
|
+
closable={false}
|
|
318
|
+
centered
|
|
319
|
+
maskClosable={false}
|
|
320
|
+
footer={null}
|
|
321
|
+
>
|
|
322
|
+
<div className="modal-body">
|
|
323
|
+
<span className="title">
|
|
324
|
+
<FormattedHTMLMessage
|
|
325
|
+
{...messages.refreshOrgText}
|
|
326
|
+
values={{ oldOrgName, newOrgName }}
|
|
327
|
+
/>
|
|
328
|
+
</span>
|
|
329
|
+
<div className="content seconds-right">
|
|
330
|
+
{formatMessage(messages.refreshText, {
|
|
331
|
+
time: `${refreshSeconds}s`,
|
|
332
|
+
})}
|
|
333
|
+
</div>
|
|
334
|
+
</div>
|
|
335
|
+
</CapModal>
|
|
336
|
+
);
|
|
337
|
+
return modalData;
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
renderOrgChangeModal = () => {
|
|
341
|
+
const { selectedOrgId, showOrgChangeModal } = this.state;
|
|
342
|
+
const {
|
|
343
|
+
Global: { user: { proxyOrgList } = {},
|
|
344
|
+
currentOrgDetails: { basic_details: { name: oldOrgName } = {} } = {},
|
|
345
|
+
},
|
|
346
|
+
intl: { formatMessage } = {},
|
|
347
|
+
} = this.props;
|
|
348
|
+
const newOrgName = getOrgNameFromId(selectedOrgId, proxyOrgList);
|
|
349
|
+
return (
|
|
350
|
+
<CapModal
|
|
351
|
+
className="change-org-confirm"
|
|
352
|
+
title={formatMessage(messages.areYouSureText)}
|
|
353
|
+
visible={showOrgChangeModal}
|
|
354
|
+
onOk={this.handleOrgChangeOk}
|
|
355
|
+
onCancel={this.handleOrgChangeCancel}
|
|
356
|
+
centered
|
|
357
|
+
okText={formatMessage(messages.changeOk)}
|
|
358
|
+
cancelText={formatMessage(messages.cancel)}
|
|
359
|
+
>
|
|
360
|
+
<FormattedHTMLMessage
|
|
361
|
+
{...messages.orgChangeText}
|
|
362
|
+
values={{ oldOrgName, newOrgName }}
|
|
363
|
+
/>
|
|
364
|
+
</CapModal>
|
|
365
|
+
);
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
handleOrgChangeOk = () => {
|
|
369
|
+
const { selectedOrgId: orgId } = this.state;
|
|
370
|
+
if (orgId !== null) {
|
|
371
|
+
this.props.actions.changeOrg(orgId);
|
|
372
|
+
this.setState({ showOrgChangeModal: false });
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
handleOrgChangeCancel = () => {
|
|
377
|
+
this.setState({ showOrgChangeModal: false });
|
|
378
|
+
};
|
|
379
|
+
|
|
179
380
|
render() {
|
|
180
381
|
const { Global, location } = this.props;
|
|
181
382
|
const { topbarMenuData, isLoggedIn, currentOrgDetails } = Global;
|
|
182
383
|
const topbarMenuDataOptions = topbarMenuData && topbarMenuData.data ? topbarMenuData.data : [];
|
|
183
384
|
const type = this.props.location.query.type;
|
|
184
385
|
const toastMessages = this.props.Global.messages;
|
|
185
|
-
const { isCreativesAccessible } = this.state;
|
|
386
|
+
const { isCreativesAccessible, showOrgChangeModal, showRefreshModal } = this.state;
|
|
186
387
|
console.log('v2 locale loading', this.props.loader.localeLoading);
|
|
187
388
|
return (
|
|
188
389
|
<CapWrapper>
|
|
@@ -231,6 +432,8 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
231
432
|
)
|
|
232
433
|
}
|
|
233
434
|
</> }
|
|
435
|
+
{showRefreshModal && this.renderOrgRefreshModal()}
|
|
436
|
+
{showOrgChangeModal && this.renderOrgChangeModal()}
|
|
234
437
|
</CapWrapper>
|
|
235
438
|
);
|
|
236
439
|
}
|
|
@@ -244,6 +447,7 @@ Cap.propTypes = {
|
|
|
244
447
|
appActions: PropTypes.object,
|
|
245
448
|
locationActions: PropTypes.object,
|
|
246
449
|
location: PropTypes.object,
|
|
450
|
+
intl: intlShape.isRequired,
|
|
247
451
|
};
|
|
248
452
|
|
|
249
453
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -72,4 +72,45 @@ export default defineMessages({
|
|
|
72
72
|
id: 'creatives.containersV2.incentive',
|
|
73
73
|
defaultMessage: 'Incentive',
|
|
74
74
|
},
|
|
75
|
+
|
|
76
|
+
//refresh due to org change messages
|
|
77
|
+
|
|
78
|
+
"refreshOrgText": {
|
|
79
|
+
id: `creatives.containersV2.refreshOrgText`,
|
|
80
|
+
defaultMessage:
|
|
81
|
+
'Refreshing this page & changing the Org from <b>{oldOrgName}</b> to <b>{newOrgName}</b>. At a time only one Org can be selected on the browser.',
|
|
82
|
+
},
|
|
83
|
+
"refreshText": {
|
|
84
|
+
id: `creatives.containersV2.refreshText`,
|
|
85
|
+
defaultMessage: 'Refreshing in {time}...',
|
|
86
|
+
},
|
|
87
|
+
"areYouSureText": {
|
|
88
|
+
id: `creatives.containersV2.areYouSureText`,
|
|
89
|
+
defaultMessage: 'Are you sure?',
|
|
90
|
+
},
|
|
91
|
+
"changeOk": {
|
|
92
|
+
id: `creatives.containersV2.changeOk`,
|
|
93
|
+
defaultMessage: 'Ok, change',
|
|
94
|
+
},
|
|
95
|
+
"cancel": {
|
|
96
|
+
id: `creatives.containersV2.cancel`,
|
|
97
|
+
defaultMessage: 'Cancel',
|
|
98
|
+
},
|
|
99
|
+
"orgChangeText": {
|
|
100
|
+
id: `creatives.containersV2.orgChangeText`,
|
|
101
|
+
defaultMessage:
|
|
102
|
+
'Changing from <b>{oldOrgName}</b> to <b>{newOrgName}</b> will change the organisation for applications open in other tabs as well.<br/>Do you want to make the change to <b>{newOrgName}</b>?',
|
|
103
|
+
},
|
|
104
|
+
"orgChangedText": {
|
|
105
|
+
id: `creatives.containersV2.orgChangedText`,
|
|
106
|
+
defaultMessage: 'Organization changed to ',
|
|
107
|
+
},
|
|
108
|
+
"orgRefreshHeading": {
|
|
109
|
+
id: `creatives.containersV2.orgRefreshHeading`,
|
|
110
|
+
defaultMessage: 'Org refresh',
|
|
111
|
+
},
|
|
112
|
+
"newOrgName": {
|
|
113
|
+
id: `creatives.containersV2.newOrgName`,
|
|
114
|
+
defaultMessage: '{newOrgName}',
|
|
115
|
+
},
|
|
75
116
|
});
|
|
@@ -69,7 +69,7 @@ const getLineType = ({
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
return {};
|
|
72
|
-
}
|
|
72
|
+
};
|
|
73
73
|
|
|
74
74
|
function SlideBoxContent(props) {
|
|
75
75
|
const {
|
|
@@ -96,6 +96,7 @@ function SlideBoxContent(props) {
|
|
|
96
96
|
cap,
|
|
97
97
|
onResetStep,
|
|
98
98
|
isFullMode,
|
|
99
|
+
editor,
|
|
99
100
|
onCallTaskSubmit,
|
|
100
101
|
setIsLoadingContent,
|
|
101
102
|
showTemplateName,
|
|
@@ -184,7 +185,7 @@ function SlideBoxContent(props) {
|
|
|
184
185
|
} = {},
|
|
185
186
|
template,
|
|
186
187
|
}) => {
|
|
187
|
-
|
|
188
|
+
const previewContent = {};
|
|
188
189
|
previewContent.messageContent = text;
|
|
189
190
|
previewContent.previewImageUrl = previewImageUrl;
|
|
190
191
|
previewContent.selectedSticker = selectedSticker || {
|
|
@@ -366,6 +367,7 @@ function SlideBoxContent(props) {
|
|
|
366
367
|
step={templateStep}
|
|
367
368
|
showNextStep={onCreateNextStep}
|
|
368
369
|
isFullMode={isFullMode}
|
|
370
|
+
editor={editor}
|
|
369
371
|
cap={cap}
|
|
370
372
|
onResetStep={onResetStep}
|
|
371
373
|
showTemplateName={showTemplateName}
|
|
@@ -392,6 +394,7 @@ function SlideBoxContent(props) {
|
|
|
392
394
|
getFormSubscriptionData={getFormData}
|
|
393
395
|
getDefaultTags={type}
|
|
394
396
|
isFullMode={isFullMode}
|
|
397
|
+
editor={editor}
|
|
395
398
|
cap={cap}
|
|
396
399
|
showTemplateName={showTemplateName}
|
|
397
400
|
onValidationFail={onValidationFail}
|
|
@@ -456,6 +459,7 @@ function SlideBoxContent(props) {
|
|
|
456
459
|
messageDetails={messageDetails}
|
|
457
460
|
cap={cap}
|
|
458
461
|
onFacebookSubmit={onFacebookSubmit}
|
|
462
|
+
isFullMode={isFullMode}
|
|
459
463
|
/>
|
|
460
464
|
)
|
|
461
465
|
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* CreativesContainer actions
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
DEFAULT_ACTION,
|
|
9
|
-
HIDE_CONTAINER_LOADER,
|
|
10
|
-
SHOW_CONTANER_LOADER,
|
|
11
|
-
} from './constants';
|
|
12
|
-
|
|
13
|
-
export function defaultAction() {
|
|
14
|
-
return {
|
|
15
|
-
type: DEFAULT_ACTION,
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
export function showCreativesContainerLoader() {
|
|
19
|
-
return {
|
|
20
|
-
type: SHOW_CONTANER_LOADER,
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
export function hideCreativesContanerLoader() {
|
|
24
|
-
return {
|
|
25
|
-
type: HIDE_CONTAINER_LOADER,
|
|
26
|
-
};
|
|
27
|
-
}
|
|
1
|
+
/*
|
|
2
|
+
*
|
|
3
|
+
* CreativesContainer actions
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
DEFAULT_ACTION,
|
|
9
|
+
HIDE_CONTAINER_LOADER,
|
|
10
|
+
SHOW_CONTANER_LOADER,
|
|
11
|
+
} from './constants';
|
|
12
|
+
|
|
13
|
+
export function defaultAction() {
|
|
14
|
+
return {
|
|
15
|
+
type: DEFAULT_ACTION,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export function showCreativesContainerLoader() {
|
|
19
|
+
return {
|
|
20
|
+
type: SHOW_CONTANER_LOADER,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export function hideCreativesContanerLoader() {
|
|
24
|
+
return {
|
|
25
|
+
type: HIDE_CONTAINER_LOADER,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* CreativesContainer constants
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export const DEFAULT_ACTION = 'app/CreativesContainer/DEFAULT_ACTION';
|
|
8
|
-
export const EMAIL = "EMAIL";
|
|
9
|
-
export const SMS = "SMS";
|
|
10
|
-
export const EBILL = "EBILL";
|
|
11
|
-
export const LINE = "LINE";
|
|
12
|
-
export const CALL_TASK = "CALL_TASK";
|
|
13
|
-
export const MOBILE_PUSH = "MOBILEPUSH";
|
|
14
|
-
export const WECHAT = "WECHAT";
|
|
15
|
-
export const FACEBOOK = "FACEBOOK";
|
|
16
|
-
export const SHOW_CONTANER_LOADER = "app/CreativesContainer/SHOW_CONTANER_LOADER";
|
|
17
|
-
export const HIDE_CONTAINER_LOADER = "app/CreativesContainer/HIDE_CONTAINER_LOADER";
|
|
1
|
+
/*
|
|
2
|
+
*
|
|
3
|
+
* CreativesContainer constants
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const DEFAULT_ACTION = 'app/CreativesContainer/DEFAULT_ACTION';
|
|
8
|
+
export const EMAIL = "EMAIL";
|
|
9
|
+
export const SMS = "SMS";
|
|
10
|
+
export const EBILL = "EBILL";
|
|
11
|
+
export const LINE = "LINE";
|
|
12
|
+
export const CALL_TASK = "CALL_TASK";
|
|
13
|
+
export const MOBILE_PUSH = "MOBILEPUSH";
|
|
14
|
+
export const WECHAT = "WECHAT";
|
|
15
|
+
export const FACEBOOK = "FACEBOOK";
|
|
16
|
+
export const SHOW_CONTANER_LOADER = "app/CreativesContainer/SHOW_CONTANER_LOADER";
|
|
17
|
+
export const HIDE_CONTAINER_LOADER = "app/CreativesContainer/HIDE_CONTAINER_LOADER";
|
|
@@ -225,9 +225,9 @@ class Creatives extends React.Component {
|
|
|
225
225
|
const messagesDefinition = JSON.parse(messages);
|
|
226
226
|
let lineContent = JSON.parse(messageBody || '{}').messages || [{}];
|
|
227
227
|
lineContent = lineContent.map((content, index) => ({
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
228
|
+
...content,
|
|
229
|
+
...(messagesDefinition[index] || {}),
|
|
230
|
+
}));
|
|
231
231
|
creativesTemplateData = {
|
|
232
232
|
type: constants.LINE,
|
|
233
233
|
isDefault,
|
|
@@ -529,7 +529,7 @@ class Creatives extends React.Component {
|
|
|
529
529
|
}
|
|
530
530
|
render() {
|
|
531
531
|
const {slidBoxContent, isGetFormData, showSlideBox, templateData, currentChannel, emailCreateMode, templateStep, isLoadingContent, mobilePushCreateMode, isDiscardMessage, weChatTemplateType, weChatMaptemplateStep} = this.state;
|
|
532
|
-
const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags, channelsToDisable, selectedOfferDetails, onTestContentClicked, onPreviewContentClicked, getCreativesData, fetchingCmsData} = this.props;
|
|
532
|
+
const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags, channelsToDisable, selectedOfferDetails, onTestContentClicked, onPreviewContentClicked, getCreativesData, fetchingCmsData, editor} = this.props;
|
|
533
533
|
const mapTemplateCreate = slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
|
|
534
534
|
/* TODO: Instead of passing down same props separately to each component down, write common function to these props and pass it accordingly */
|
|
535
535
|
return (
|
|
@@ -602,6 +602,7 @@ class Creatives extends React.Component {
|
|
|
602
602
|
selectedAccount={this.props.selectedAccount}
|
|
603
603
|
onShowTemplates={this.onShowTemplates}
|
|
604
604
|
handleClose={this.handleCloseSlideBox}
|
|
605
|
+
editor={editor}
|
|
605
606
|
/>
|
|
606
607
|
}
|
|
607
608
|
footer={this.shouldShowFooter() &&
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
@import '~@capillarytech/cap-ui-library/styles/_variables.scss';
|
|
2
|
-
|
|
3
|
-
$classPrefix: add-creatives-section;
|
|
4
|
-
|
|
5
|
-
.#{$classPrefix} {
|
|
6
|
-
&.creatives-library-mode{
|
|
7
|
-
.sms-create-container, .sms-email-container{
|
|
8
|
-
.ant-tabs-top-bar{
|
|
9
|
-
display: none;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
.#{$classPrefix}-footer {
|
|
14
|
-
position: absolute;
|
|
15
|
-
bottom: 0;
|
|
16
|
-
left: 1px;
|
|
17
|
-
padding: 0 12px;
|
|
18
|
-
display: flex;
|
|
19
|
-
align-items: center;
|
|
20
|
-
height: 48px;
|
|
21
|
-
border-top: 1px solid $CAP_G07;
|
|
22
|
-
|
|
23
|
-
&.with-creative {
|
|
24
|
-
width: 100%;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
.wechat-steps {
|
|
28
|
-
width: 40% !important;
|
|
29
|
-
left: 20%;
|
|
30
|
-
position: relative;
|
|
31
|
-
.ant-steps-item-title::after {
|
|
32
|
-
top: 8px;
|
|
33
|
-
}
|
|
34
|
-
.ant-steps-item-content {
|
|
35
|
-
vertical-align: middle;
|
|
36
|
-
padding-top: 4px;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.map-template-create {
|
|
42
|
-
.slidebox-header div:first-child {
|
|
43
|
-
width: 100%;
|
|
44
|
-
}
|
|
1
|
+
@import '~@capillarytech/cap-ui-library/styles/_variables.scss';
|
|
2
|
+
|
|
3
|
+
$classPrefix: add-creatives-section;
|
|
4
|
+
|
|
5
|
+
.#{$classPrefix} {
|
|
6
|
+
&.creatives-library-mode{
|
|
7
|
+
.sms-create-container, .sms-email-container{
|
|
8
|
+
.ant-tabs-top-bar{
|
|
9
|
+
display: none;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
.#{$classPrefix}-footer {
|
|
14
|
+
position: absolute;
|
|
15
|
+
bottom: 0;
|
|
16
|
+
left: 1px;
|
|
17
|
+
padding: 0 12px;
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
height: 48px;
|
|
21
|
+
border-top: 1px solid $CAP_G07;
|
|
22
|
+
|
|
23
|
+
&.with-creative {
|
|
24
|
+
width: 100%;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
.wechat-steps {
|
|
28
|
+
width: 40% !important;
|
|
29
|
+
left: 20%;
|
|
30
|
+
position: relative;
|
|
31
|
+
.ant-steps-item-title::after {
|
|
32
|
+
top: 8px;
|
|
33
|
+
}
|
|
34
|
+
.ant-steps-item-content {
|
|
35
|
+
vertical-align: middle;
|
|
36
|
+
padding-top: 4px;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.map-template-create {
|
|
42
|
+
.slidebox-header div:first-child {
|
|
43
|
+
width: 100%;
|
|
44
|
+
}
|
|
45
45
|
}
|