@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
|
@@ -13,6 +13,25 @@ export const getTopbarMenuDataValue = () => ([
|
|
|
13
13
|
{ label: <FormattedMessage {...globalMessages.creatives} />, link: '/creatives/ui/v2', key: 'creatives' },
|
|
14
14
|
]);
|
|
15
15
|
|
|
16
|
+
export const getLoyaltyTopbarMenuDataValue = () => [
|
|
17
|
+
{
|
|
18
|
+
label: <FormattedMessage {...globalMessages.programs} />,
|
|
19
|
+
link: 'loyalty/ui/',
|
|
20
|
+
key: 'programs',
|
|
21
|
+
},
|
|
22
|
+
//commented as promotions are not supported in loyalty v2 flow
|
|
23
|
+
// {
|
|
24
|
+
// label: <FormattedMessage {...globalMessages.promotions} />,
|
|
25
|
+
// link: 'loyalty/ui/promotions/',
|
|
26
|
+
// key: 'promotions',
|
|
27
|
+
// },
|
|
28
|
+
{
|
|
29
|
+
label: <FormattedMessage {...globalMessages.creatives} />,
|
|
30
|
+
link: '/creatives/ui/v2/loyalty',
|
|
31
|
+
key: 'creatives',
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
|
|
16
35
|
export const TRACK_CREATE_SMS = 'createSms';
|
|
17
36
|
export const TRACK_CREATE_EMAIL = 'createEmail';
|
|
18
37
|
export const TRACK_CREATE_MPUSH = 'createMpush';
|
|
@@ -46,7 +65,7 @@ export const CHANNEL_CREATE_TRACK_MAPPING = {
|
|
|
46
65
|
gallery: TRACK_CREATE_IMAGE,
|
|
47
66
|
line: TRACK_CREATE_LINE,
|
|
48
67
|
viber: TRACK_CREATE_VIBER,
|
|
49
|
-
facebook: TRACK_CREATE_FACEBOOK
|
|
68
|
+
facebook: TRACK_CREATE_FACEBOOK,
|
|
50
69
|
};
|
|
51
70
|
|
|
52
71
|
export const CHANNEL_EDIT_TRACK_MAPPING = {
|
|
@@ -57,7 +76,7 @@ export const CHANNEL_EDIT_TRACK_MAPPING = {
|
|
|
57
76
|
gallery: TRACK_EDIT_IMAGE,
|
|
58
77
|
line: TRACK_EDIT_LINE,
|
|
59
78
|
viber: TRACK_EDIT_VIBER,
|
|
60
|
-
facebook: TRACK_EDIT_FACEBOOK
|
|
79
|
+
facebook: TRACK_EDIT_FACEBOOK,
|
|
61
80
|
};
|
|
62
81
|
export const GTM_TRACKING_ID = 'UA-110024621-2';
|
|
63
82
|
export const BEE_PLUGIN = 'BEE_PLUGIN';
|
|
@@ -85,4 +104,5 @@ export const FB_AD_CALL_TO_ACTION = {
|
|
|
85
104
|
};
|
|
86
105
|
|
|
87
106
|
|
|
88
|
-
export const CREATIVES = 'creatives';
|
|
107
|
+
export const CREATIVES = 'creatives';
|
|
108
|
+
export const LOYALTY = 'loyalty';
|
|
@@ -45,7 +45,6 @@ export function getUserData(callback) {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
export function fetchSchemaForEntity(queryParams) {
|
|
48
|
-
|
|
49
48
|
return {
|
|
50
49
|
type: types.GET_SCHEMA_FOR_ENTITY_REQUEST, queryParams,
|
|
51
50
|
};
|
|
@@ -62,8 +61,9 @@ export function setInjectedTags(injectedTags) {
|
|
|
62
61
|
};
|
|
63
62
|
}
|
|
64
63
|
|
|
65
|
-
export function getTopbarMenuData() {
|
|
64
|
+
export function getTopbarMenuData(parentModule) {
|
|
66
65
|
return {
|
|
66
|
+
parentModule,
|
|
67
67
|
type: types.GET_TOPBAR_MENU_DATA_REQUEST,
|
|
68
68
|
};
|
|
69
69
|
}
|
|
@@ -31,7 +31,8 @@ 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
|
+
export const LOYALTY_HELP_URL = 'https://support.capillarytech.com/en/support/solutions/97443';
|
|
34
35
|
|
|
35
|
-
export const ORG_REFRESH_SEC = 10;
|
|
36
|
-
export const ORG_CHANGED = 'ORG_CHANGED';
|
|
36
|
+
export const ORG_REFRESH_SEC = 10;
|
|
37
|
+
export const ORG_CHANGED = 'ORG_CHANGED';
|
|
37
38
|
|
|
@@ -22,11 +22,10 @@ import { engagePlusPublicPath } from '../../config/path';
|
|
|
22
22
|
import { GTM_TRACKING_ID, CREATIVES_UI_VIEW } from '../App/constants';
|
|
23
23
|
import { makeSelectLocale } from '../../v2Containers/LanguageProvider/selectors';
|
|
24
24
|
import {
|
|
25
|
-
HELP_URL,
|
|
26
25
|
ORG_SETTINGS_URL,
|
|
27
26
|
CAMPAIGN_SETTINGS_URL,
|
|
28
27
|
ORG_REFRESH_SEC,
|
|
29
|
-
ORG_CHANGED
|
|
28
|
+
ORG_CHANGED,
|
|
30
29
|
} from './constants';
|
|
31
30
|
import './_cap.scss';
|
|
32
31
|
|
|
@@ -73,6 +72,8 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
73
72
|
}
|
|
74
73
|
|
|
75
74
|
componentWillMount() {
|
|
75
|
+
const { pathname } = this.props.location;
|
|
76
|
+
const parentModule = pathname.substring(pathname.lastIndexOf('/') + 1);
|
|
76
77
|
this.props.actions.getUserData((userData) => {
|
|
77
78
|
if (!userData.accessiblePermissions.includes(CREATIVES_UI_VIEW)) {
|
|
78
79
|
this.setState({ isCreativesAccessible: false });
|
|
@@ -81,7 +82,7 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
81
82
|
this.setDimensionData(userGtmData);
|
|
82
83
|
gtm.push({...userGtmData, event: 'userAuthenticated'});
|
|
83
84
|
});
|
|
84
|
-
this.props.actions.getTopbarMenuData();
|
|
85
|
+
this.props.actions.getTopbarMenuData(parentModule);
|
|
85
86
|
if (this.props.Global.orgID !== undefined) {
|
|
86
87
|
gtm.push({orgId: this.props.Global.orgID});
|
|
87
88
|
}
|
|
@@ -101,7 +102,7 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
101
102
|
}
|
|
102
103
|
locale = this.getMappedLocale(locale);
|
|
103
104
|
//locale = 'zh';
|
|
104
|
-
|
|
105
|
+
|
|
105
106
|
moment.locale(locale);
|
|
106
107
|
window.addEventListener('storage', this.handleStorageChange, false);
|
|
107
108
|
document.addEventListener(
|
|
@@ -167,7 +168,7 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
167
168
|
tabOnloadEventHandler = () => {
|
|
168
169
|
logNewTab();
|
|
169
170
|
}
|
|
170
|
-
|
|
171
|
+
|
|
171
172
|
setDimensionData(userGtmData) {
|
|
172
173
|
Object.values(userGtmData).forEach((value, index) => {
|
|
173
174
|
GA.setCustomDimension({ [`dimension${index + 1}`]: value });
|
|
@@ -175,28 +176,41 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
175
176
|
}
|
|
176
177
|
getUserGtmData(props) {
|
|
177
178
|
const selectedProps = props || this.props;
|
|
178
|
-
const { user: userData,
|
|
179
|
+
const { user: userData, orgID, currentOrgDetails} = selectedProps?.Global || {};
|
|
180
|
+
const {
|
|
181
|
+
basic_details: {
|
|
182
|
+
base_country: orgBaseCountry = '',
|
|
183
|
+
base_currency: orgBaseCurrency = '',
|
|
184
|
+
base_language: orgBaseLanguage = '',
|
|
185
|
+
} = {},
|
|
186
|
+
} = currentOrgDetails || {};
|
|
179
187
|
if (userData) {
|
|
180
188
|
const {
|
|
181
189
|
attributes: {
|
|
182
|
-
USERNAME
|
|
183
|
-
EMAIL
|
|
190
|
+
USERNAME: userName,
|
|
191
|
+
EMAIL: userEmail,
|
|
184
192
|
} = {},
|
|
185
|
-
proxyOrgList =[],
|
|
193
|
+
proxyOrgList = [],
|
|
186
194
|
isCapUser,
|
|
187
195
|
refID,
|
|
196
|
+
type: userRole = '',
|
|
188
197
|
orgName: userOrgName,
|
|
189
198
|
} = userData;
|
|
190
|
-
const { orgName } = _.find(proxyOrgList, { orgID
|
|
199
|
+
const { orgName } = _.find(proxyOrgList, { orgID }) || {
|
|
191
200
|
orgName: userOrgName,
|
|
192
201
|
};
|
|
193
202
|
const gtmData = {
|
|
194
|
-
isCapUser
|
|
203
|
+
isCapUser,
|
|
195
204
|
orgId: orgID,
|
|
196
205
|
orgName,
|
|
197
206
|
userId: refID,
|
|
198
207
|
userName: userName?.value,
|
|
199
208
|
userEmail: userEmail?.value,
|
|
209
|
+
userRole,
|
|
210
|
+
orgBaseCountry,
|
|
211
|
+
orgBaseCurrency,
|
|
212
|
+
orgBaseLanguage,
|
|
213
|
+
domainName: userEmail?.value?.split('@').pop(),
|
|
200
214
|
};
|
|
201
215
|
return gtmData;
|
|
202
216
|
}
|
|
@@ -272,7 +286,7 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
272
286
|
refreshSeconds === ORG_REFRESH_SEC
|
|
273
287
|
) {
|
|
274
288
|
const timer = setInterval(() => {
|
|
275
|
-
this.setState(prevState => ({
|
|
289
|
+
this.setState((prevState) => ({
|
|
276
290
|
refreshSeconds: prevState.refreshSeconds - 1,
|
|
277
291
|
}));
|
|
278
292
|
}, 1000);
|
|
@@ -286,13 +300,13 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
286
300
|
|
|
287
301
|
handleStorageChange = (e) => {
|
|
288
302
|
const { oldValue, newValue } = e;
|
|
289
|
-
|
|
303
|
+
if (utilsHandleStorageChange(e, 'orgID')) {
|
|
290
304
|
const localStorageOrgInfo = { oldValue, newValue };
|
|
291
305
|
this.setState({ showRefreshModal: true, localStorageOrgInfo });
|
|
292
306
|
}
|
|
293
307
|
};
|
|
294
308
|
|
|
295
|
-
getOrgNameFromId = orgId => {
|
|
309
|
+
getOrgNameFromId = (orgId) => {
|
|
296
310
|
const {
|
|
297
311
|
Global: {
|
|
298
312
|
user: {
|
|
@@ -352,11 +366,11 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
352
366
|
renderOrgChangeModal = () => {
|
|
353
367
|
const { selectedOrgId, showOrgChangeModal } = this.state;
|
|
354
368
|
const {
|
|
355
|
-
Global: {
|
|
369
|
+
Global: {
|
|
356
370
|
currentOrgDetails: { basic_details: { name: oldOrgName } = {} } = {},
|
|
357
371
|
},
|
|
358
372
|
intl: { formatMessage } = {},
|
|
359
|
-
} = this.props;
|
|
373
|
+
} = this.props;
|
|
360
374
|
const newOrgName = this.getOrgNameFromId(selectedOrgId);
|
|
361
375
|
// some users do not have entry for their default org in proxyOrgList.
|
|
362
376
|
// getOrgNameFromId returns back orgID if no matching entry is present in proxyOrgList
|
|
@@ -399,7 +413,7 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
399
413
|
const type = this.props.location.query.type;
|
|
400
414
|
const toastMessages = this.props.Global.messages;
|
|
401
415
|
const { isCreativesAccessible, showOrgChangeModal, showRefreshModal } = this.state;
|
|
402
|
-
|
|
416
|
+
|
|
403
417
|
return (
|
|
404
418
|
<CapWrapper>
|
|
405
419
|
{ this.props.loader.localeLoading || this.props.Global.fetching_userdata ?
|
|
@@ -425,7 +439,6 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
425
439
|
logout={this.logout}
|
|
426
440
|
settingsUrl={`${engagePlusPublicPath}${CAMPAIGN_SETTINGS_URL}`}
|
|
427
441
|
orgSettingsUrl={ORG_SETTINGS_URL}
|
|
428
|
-
helpUrl={HELP_URL}
|
|
429
442
|
loggedIn={isLoggedIn}
|
|
430
443
|
topbarMenuData={topbarMenuDataOptions}
|
|
431
444
|
location={location}
|
|
@@ -72,6 +72,14 @@ export default defineMessages({
|
|
|
72
72
|
id: 'creatives.containersV2.incentive',
|
|
73
73
|
defaultMessage: 'Incentive',
|
|
74
74
|
},
|
|
75
|
+
"programs": {
|
|
76
|
+
id: `creatives.containersV2.programs`,
|
|
77
|
+
defaultMessage: 'Programs',
|
|
78
|
+
},
|
|
79
|
+
"promotions": {
|
|
80
|
+
id: `creatives.containersV2.promotions`,
|
|
81
|
+
defaultMessage: 'Promotions',
|
|
82
|
+
},
|
|
75
83
|
|
|
76
84
|
//refresh due to org change messages
|
|
77
85
|
|
|
@@ -6,7 +6,11 @@ import * as LocalStorage from '../../services/localStorageApi';
|
|
|
6
6
|
import * as types from './constants';
|
|
7
7
|
import config from '../../config/app';
|
|
8
8
|
//import pathConfig from '../../config/path';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
getTopbarMenuDataValue,
|
|
11
|
+
getLoyaltyTopbarMenuDataValue,
|
|
12
|
+
LOYALTY,
|
|
13
|
+
} from '../../v2Containers/App/constants';
|
|
10
14
|
// import {makeSelectOrgId} from './selectors';
|
|
11
15
|
|
|
12
16
|
function* authorize(user) {
|
|
@@ -106,9 +110,8 @@ export function* fetchUserInfo(option) {
|
|
|
106
110
|
|
|
107
111
|
export function* fetchSchemaForEntity(queryParams) {
|
|
108
112
|
try {
|
|
109
|
-
|
|
110
113
|
const result = yield call(Api.fetchSchemaForEntity, queryParams);
|
|
111
|
-
|
|
114
|
+
|
|
112
115
|
// const sidebar = result.response.sidebar;
|
|
113
116
|
yield put({ type: types.GET_SCHEMA_FOR_ENTITY_SUCCESS, data: result.response, statusCode: result.status ? result.status.code : '', entityType: queryParams.queryParams.type });
|
|
114
117
|
} catch (error) {
|
|
@@ -116,11 +119,21 @@ export function* fetchSchemaForEntity(queryParams) {
|
|
|
116
119
|
}
|
|
117
120
|
}
|
|
118
121
|
|
|
119
|
-
|
|
122
|
+
const getTopbarData = (parentModule) => {
|
|
123
|
+
switch (parentModule) {
|
|
124
|
+
case LOYALTY:
|
|
125
|
+
return getLoyaltyTopbarMenuDataValue();
|
|
126
|
+
default:
|
|
127
|
+
return getTopbarMenuDataValue();
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
function* getTopbarMenuData(params) {
|
|
132
|
+
const {parentModule} = params;
|
|
120
133
|
try {
|
|
121
134
|
yield put({
|
|
122
135
|
type: types.GET_TOPBAR_MENU_DATA_SUCCESS,
|
|
123
|
-
data:
|
|
136
|
+
data: getTopbarData(parentModule),
|
|
124
137
|
});
|
|
125
138
|
} catch (error) {
|
|
126
139
|
yield put({ type: types.GET_TOPBAR_MENU_DATA_FAILURE, error });
|
|
@@ -129,7 +142,6 @@ function* getTopbarMenuData() {
|
|
|
129
142
|
|
|
130
143
|
|
|
131
144
|
function* watchFetchSchemaForEntity() {
|
|
132
|
-
|
|
133
145
|
const watcher = yield takeLatest(types.GET_SCHEMA_FOR_ENTITY_REQUEST, fetchSchemaForEntity);
|
|
134
146
|
yield take(LOCATION_CHANGE);
|
|
135
147
|
yield cancel(watcher);
|
|
@@ -11,3 +11,7 @@ export const GENERATE_PREVIEW_FAILURE = 'app/CapFacebookPreview/GET_PREVIEW_FAIL
|
|
|
11
11
|
|
|
12
12
|
export const CLEAR_PREVIEW = 'app/CapFacebookPreview/CLEAR_PREVIEW';
|
|
13
13
|
|
|
14
|
+
export const PREVIEW_NOT_REQUESTED = "PreviewNotRequested";
|
|
15
|
+
export const FETCH_PREVIEW_REQUESTED = "PreviewRequested";
|
|
16
|
+
export const FETCH_PREVIEW_SUCCESS = "PreviewRequestSuccess";
|
|
17
|
+
export const FETCH_PREVIEW_FAILURE = "PreviewRequestFailure";
|
|
@@ -30,6 +30,11 @@ import {
|
|
|
30
30
|
CAROUSEL,
|
|
31
31
|
NO_CALL_TO_ACTION,
|
|
32
32
|
} from '../../v2Containers/Facebook/Advertisement/constant';
|
|
33
|
+
import {
|
|
34
|
+
FETCH_PREVIEW_REQUESTED,
|
|
35
|
+
FETCH_PREVIEW_SUCCESS,
|
|
36
|
+
PREVIEW_NOT_REQUESTED,
|
|
37
|
+
} from './constants';
|
|
33
38
|
import './index.scss';
|
|
34
39
|
|
|
35
40
|
export const CapFacebookPreview = (props) => {
|
|
@@ -55,7 +60,10 @@ export const CapFacebookPreview = (props) => {
|
|
|
55
60
|
const [disableAfterPreviewGenerate, setDisableAfterPreviewGenerate] = useState(false);
|
|
56
61
|
const [random, setRandom] = useState(0);
|
|
57
62
|
const {pageAccessToken, pageId} = orgUnitFacebookPageSettingsMap;
|
|
58
|
-
const {previewIframe = "",
|
|
63
|
+
const {previewIframe = "", fetchPreviewStatus = PREVIEW_NOT_REQUESTED, previewIframeError = ""} = facebookPreviewData;
|
|
64
|
+
const [previewLoaded, setPreviewLoaded] = useState(false);
|
|
65
|
+
const [isRefreshing, setIsRefreshing] = useState(false);
|
|
66
|
+
let isSpinning = false;
|
|
59
67
|
const facebookAdOptions = [
|
|
60
68
|
{
|
|
61
69
|
value: "DESKTOP_FEED_STANDARD",
|
|
@@ -284,9 +292,17 @@ export const CapFacebookPreview = (props) => {
|
|
|
284
292
|
};
|
|
285
293
|
|
|
286
294
|
const resetIframe = () => {
|
|
295
|
+
previewLoaded && setPreviewLoaded(false);
|
|
296
|
+
!isRefreshing && setIsRefreshing(true);
|
|
287
297
|
const r = random + 1;
|
|
288
298
|
setRandom(r);
|
|
289
299
|
};
|
|
300
|
+
const unsetLoader = () => {
|
|
301
|
+
setTimeout(function() {
|
|
302
|
+
!previewLoaded && setPreviewLoaded(true);
|
|
303
|
+
isRefreshing && setIsRefreshing(false);
|
|
304
|
+
}.bind(this), 5000);
|
|
305
|
+
}
|
|
290
306
|
const getIframe = (iframe) => {
|
|
291
307
|
const divTag = document.createElement('div');
|
|
292
308
|
divTag.innerHTML = iframe;
|
|
@@ -295,13 +311,16 @@ export const CapFacebookPreview = (props) => {
|
|
|
295
311
|
<iframe
|
|
296
312
|
src={src}
|
|
297
313
|
key={random}
|
|
298
|
-
style={{border: "none"}}
|
|
314
|
+
style={{ border: "none" }}
|
|
299
315
|
width={"600px"}
|
|
300
316
|
scrolling="no"
|
|
301
317
|
height={"1000px"}
|
|
302
318
|
className="cap-facebook-ad-iframe"
|
|
319
|
+
onLoad={
|
|
320
|
+
unsetLoader()
|
|
321
|
+
}
|
|
303
322
|
/>
|
|
304
|
-
|
|
323
|
+
</>);
|
|
305
324
|
};
|
|
306
325
|
|
|
307
326
|
const showRefreshButton = () => {
|
|
@@ -340,74 +359,80 @@ export const CapFacebookPreview = (props) => {
|
|
|
340
359
|
}
|
|
341
360
|
}, [previewIframeError]);
|
|
342
361
|
return (
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
362
|
+
<>
|
|
363
|
+
{isSpinning = (fetchPreviewStatus === FETCH_PREVIEW_REQUESTED) ||
|
|
364
|
+
((fetchPreviewStatus === FETCH_PREVIEW_SUCCESS) && !previewLoaded) ||
|
|
365
|
+
isRefreshing}
|
|
366
|
+
<CapSpin
|
|
367
|
+
spinning={isSpinning}>
|
|
368
|
+
<div style={{ display: 'inline-block' }}>
|
|
369
|
+
<CapSelect
|
|
370
|
+
label={formatMessage(messages.previewBasedonAdPlacement)}
|
|
371
|
+
key={"select-previewBasedonAdPlacement"}
|
|
372
|
+
onChange={onChangeAdPreviewFormat}
|
|
373
|
+
style={{ width: '328px', paddingBottom: 16 }}
|
|
374
|
+
options={adOptions}
|
|
375
|
+
value={adPreviewFormat}
|
|
376
|
+
>
|
|
377
|
+
</CapSelect>
|
|
378
|
+
</div>
|
|
379
|
+
{!hideInfoText && <CapLabel
|
|
380
|
+
type="label1"
|
|
381
|
+
style={{ paddingBottom: 16, textAlign: 'left', width: 392 }}
|
|
352
382
|
>
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
383
|
+
{formatMessage(messages.previewAdDesc)}
|
|
384
|
+
</CapLabel>}
|
|
385
|
+
<div style={{ marginBottom: 16 }}>
|
|
386
|
+
{(disablePreviewButton || disableAfterPreviewGenerate) ?
|
|
387
|
+
<CapTooltip title={formatMessage(messages.generatePreviewDisableToolTip)}>
|
|
388
|
+
<div className="button-disabled-tooltip-wrapper">
|
|
389
|
+
<CapButton
|
|
390
|
+
type="secondary"
|
|
391
|
+
disabled
|
|
358
392
|
>
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
</div>
|
|
372
|
-
</CapTooltip> :
|
|
373
|
-
<CapButton
|
|
393
|
+
<FormattedMessage {...messages.generatePreview} />
|
|
394
|
+
</CapButton>
|
|
395
|
+
</div>
|
|
396
|
+
</CapTooltip> :
|
|
397
|
+
<CapButton
|
|
398
|
+
type="secondary"
|
|
399
|
+
onClick={generatePreview}
|
|
400
|
+
>
|
|
401
|
+
<FormattedMessage {...messages.generatePreview} />
|
|
402
|
+
</CapButton>}
|
|
403
|
+
{isRefreshButton && (<CapButton
|
|
404
|
+
onClick={resetIframe}
|
|
374
405
|
type="secondary"
|
|
375
|
-
|
|
406
|
+
style={{ marginLeft: 16 }}
|
|
376
407
|
>
|
|
377
|
-
|
|
378
|
-
</CapButton>}
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
</
|
|
404
|
-
|
|
405
|
-
src={facebookEmptyPlaceholder}
|
|
406
|
-
alt="default"
|
|
407
|
-
width="316px"
|
|
408
|
-
height="392px"
|
|
409
|
-
/> : getIframe(previewIframe)}
|
|
410
|
-
</CapSpin>
|
|
408
|
+
{formatMessage(messages.refreshPreview)}
|
|
409
|
+
</CapButton>)}
|
|
410
|
+
</div>
|
|
411
|
+
{isRefreshButton && <div style={{ marginBottom: 16 }}>
|
|
412
|
+
<CapIcon
|
|
413
|
+
type="info"
|
|
414
|
+
svgProps={{
|
|
415
|
+
width: 16,
|
|
416
|
+
height: 16,
|
|
417
|
+
}}
|
|
418
|
+
>
|
|
419
|
+
</CapIcon>
|
|
420
|
+
<CapLabel.CapLabelInline
|
|
421
|
+
type="label1"
|
|
422
|
+
size="s"
|
|
423
|
+
style={{ marginBottom: 16, width: 392 }}
|
|
424
|
+
>
|
|
425
|
+
{formatMessage(messages.videoNotePreview)}
|
|
426
|
+
</CapLabel.CapLabelInline>
|
|
427
|
+
</div>}
|
|
428
|
+
{previewIframe === "" ? <CapImage
|
|
429
|
+
src={facebookEmptyPlaceholder}
|
|
430
|
+
alt="default"
|
|
431
|
+
width="316px"
|
|
432
|
+
height="392px"
|
|
433
|
+
/> : getIframe(previewIframe)}
|
|
434
|
+
</CapSpin>
|
|
435
|
+
</>
|
|
411
436
|
);
|
|
412
437
|
};
|
|
413
438
|
|
|
@@ -6,29 +6,38 @@
|
|
|
6
6
|
|
|
7
7
|
import { fromJS } from 'immutable';
|
|
8
8
|
import get from 'lodash/get';
|
|
9
|
-
import
|
|
9
|
+
import {
|
|
10
|
+
GENERATE_PREVIEW_REQUEST,
|
|
11
|
+
GENERATE_PREVIEW_SUCCESS,
|
|
12
|
+
GENERATE_PREVIEW_FAILURE,
|
|
13
|
+
CLEAR_PREVIEW,
|
|
14
|
+
FETCH_PREVIEW_REQUESTED,
|
|
15
|
+
FETCH_PREVIEW_SUCCESS,
|
|
16
|
+
FETCH_PREVIEW_FAILURE,
|
|
17
|
+
PREVIEW_NOT_REQUESTED,
|
|
18
|
+
} from './constants';
|
|
10
19
|
|
|
11
20
|
const initialState = fromJS({
|
|
12
|
-
|
|
21
|
+
fetchPreviewStatus: PREVIEW_NOT_REQUESTED,
|
|
13
22
|
previewIframe: "",
|
|
14
23
|
previewIframeError: "",
|
|
15
24
|
});
|
|
16
25
|
|
|
17
26
|
function capFacebookPreviewReducer(state = initialState, action) {
|
|
18
27
|
switch (action.type) {
|
|
19
|
-
case
|
|
20
|
-
return state.set('
|
|
28
|
+
case GENERATE_PREVIEW_REQUEST:
|
|
29
|
+
return state.set('fetchPreviewStatus', FETCH_PREVIEW_REQUESTED)
|
|
21
30
|
.set('previewIframe', "")
|
|
22
31
|
.set("previewIframeError", "");
|
|
23
|
-
case
|
|
24
|
-
return state.set('
|
|
32
|
+
case GENERATE_PREVIEW_SUCCESS:
|
|
33
|
+
return state.set('fetchPreviewStatus', FETCH_PREVIEW_SUCCESS)
|
|
25
34
|
.set('previewIframe', get(action, 'payload.fbPreview[0].body', ""));
|
|
26
|
-
case
|
|
27
|
-
return state.set('
|
|
35
|
+
case GENERATE_PREVIEW_FAILURE:
|
|
36
|
+
return state.set('fetchPreviewStatus', FETCH_PREVIEW_FAILURE)
|
|
28
37
|
.set('previewIframe', "")
|
|
29
38
|
.set("previewIframeError", get(action, 'payload.message', ""));
|
|
30
|
-
case
|
|
31
|
-
return state.set('
|
|
39
|
+
case CLEAR_PREVIEW:
|
|
40
|
+
return state.set('fetchPreviewStatus', PREVIEW_NOT_REQUESTED)
|
|
32
41
|
.set('previewIframe', "")
|
|
33
42
|
.set("previewIframeError", "");
|
|
34
43
|
default:
|
|
@@ -578,6 +578,7 @@ function SlideBoxContent(props) {
|
|
|
578
578
|
templateData={templateData}
|
|
579
579
|
messageDetails={messageDetails}
|
|
580
580
|
cap={cap}
|
|
581
|
+
createNew={onCreateNew}
|
|
581
582
|
onFacebookSubmit={onFacebookSubmit}
|
|
582
583
|
onCreateComplete={onCreateComplete}
|
|
583
584
|
isFullMode={isFullMode}
|
|
@@ -586,6 +587,7 @@ function SlideBoxContent(props) {
|
|
|
586
587
|
}}
|
|
587
588
|
getFormSubscriptionData={getFormData}
|
|
588
589
|
fbAdManager={fbAdManager}
|
|
590
|
+
onSelectTemplate={onSelectTemplate}
|
|
589
591
|
/>
|
|
590
592
|
)
|
|
591
593
|
}
|