@capillarytech/creatives-library 7.17.89 → 7.17.91-alpha.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/containers/App/constants.js +1 -0
- package/initialState.js +1 -0
- package/package.json +1 -1
- package/services/api.js +5 -0
- package/services/tests/api.test.js +6 -0
- package/utils/common.js +5 -0
- package/v2Components/CapTagList/index.js +45 -5
- package/v2Components/CapTagList/messages.js +8 -0
- package/v2Components/CapTagList/style.scss +21 -0
- package/v2Components/FormBuilder/index.js +19 -1
- package/v2Components/FormBuilder/messages.js +4 -0
- package/v2Containers/Cap/actions.js +4 -0
- package/v2Containers/Cap/constants.js +14 -0
- package/v2Containers/Cap/index.js +51 -3
- package/v2Containers/Cap/reducer.js +18 -3
- package/v2Containers/Cap/sagas.js +48 -2
- package/v2Containers/Cap/selectors.js +14 -0
- package/v2Containers/Cap/tests/Cap.test.js +161 -0
- package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +1 -0
- package/v2Containers/Cap/tests/actions.test.js +11 -0
- package/v2Containers/Cap/tests/reducer.test.js +59 -0
- package/v2Containers/Cap/tests/saga.test.js +170 -2
- package/v2Containers/Cap/tests/selectors.test.js +42 -18
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +3 -0
- package/v2Containers/CreativesContainer/index.js +1 -0
- package/v2Containers/CreativesContainer/index.scss +9 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +5 -0
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +1 -0
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +31 -0
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4 -0
- package/v2Containers/TagList/index.js +8 -1
- package/v2Containers/Whatsapp/index.js +1 -0
- package/v2Containers/Whatsapp/selectors.js +1 -1
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +4 -0
- package/v2Containers/mockdata.js +602 -0
|
@@ -15,6 +15,7 @@ export const EXTENDED_TAG = 'ExtendedTagMessage';
|
|
|
15
15
|
export const BADGES_UI_ENABLED = 'BADGES_UI_ENABLED';
|
|
16
16
|
export const JP_LOCALE_HIDE_FEATURE = 'JP_LOCALE_HIDE_FEATURE';
|
|
17
17
|
export const ENABLE_CUSTOMER_BARCODE_TAG = "ENABLE_CUSTOMER_BARCODE_TAG";
|
|
18
|
+
export const EMAIL_UNSUBSCRIBE_TAG_MANDATORY = "EMAIL_UNSUBSCRIBE_TAG_MANDATORY";
|
|
18
19
|
|
|
19
20
|
export const CARD_RELATED_TAGS = [
|
|
20
21
|
'card_series',
|
package/initialState.js
CHANGED
package/package.json
CHANGED
package/services/api.js
CHANGED
|
@@ -509,3 +509,8 @@ export const getMetaTags = ({previewUrl}) => {
|
|
|
509
509
|
const url = `${API_ENDPOINT}/common/getMetaTags?url=${previewUrl}`;
|
|
510
510
|
return request(url, getAPICallObject('GET'));
|
|
511
511
|
};
|
|
512
|
+
|
|
513
|
+
export const getSupportVideosConfig = () => {
|
|
514
|
+
const url = `${ARYA_ENDPOINT}/support_videos/?product=Creatives`;
|
|
515
|
+
return request(url, getAPICallObject('GET'));
|
|
516
|
+
};
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
getCdnTransformationConfig,
|
|
5
5
|
createWhatsappTemplate,
|
|
6
6
|
getMetaTags,
|
|
7
|
+
getSupportVideosConfig,
|
|
7
8
|
} from '../api';
|
|
8
9
|
import { mockData } from './mockData';
|
|
9
10
|
const sampleFile = require('../../assets/line.png');
|
|
@@ -52,3 +53,8 @@ describe('getMetaTags -- Test with valid responses', () => {
|
|
|
52
53
|
getMetaTags({previewUrl: 'https://capillarytech.com'}),
|
|
53
54
|
).toEqual(Promise.resolve()));
|
|
54
55
|
});
|
|
56
|
+
|
|
57
|
+
describe('getSupportVideosConfig -- Test with valid responses', () => {
|
|
58
|
+
it('Should return correct response', () =>
|
|
59
|
+
expect(getSupportVideosConfig()).toEqual(Promise.resolve()));
|
|
60
|
+
});
|
package/utils/common.js
CHANGED
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
ENABLE_CUSTOMER_BARCODE_TAG,
|
|
18
18
|
BADGES_UI_ENABLED,
|
|
19
19
|
BADGES_ENROLL,
|
|
20
|
+
EMAIL_UNSUBSCRIBE_TAG_MANDATORY,
|
|
20
21
|
} from '../containers/App/constants';
|
|
21
22
|
import { apiMessageFormatHandler } from './commonUtils';
|
|
22
23
|
|
|
@@ -104,6 +105,10 @@ export const hasCustomerBarcodeFeatureEnabled = Auth.hasFeatureAccess.bind(
|
|
|
104
105
|
ENABLE_CUSTOMER_BARCODE_TAG,
|
|
105
106
|
);
|
|
106
107
|
|
|
108
|
+
export const hasRemoveEmailUnsubscribeTag = Auth.hasFeatureAccess.bind(
|
|
109
|
+
null,
|
|
110
|
+
EMAIL_UNSUBSCRIBE_TAG_MANDATORY,
|
|
111
|
+
);
|
|
107
112
|
//filtering tags based on scope
|
|
108
113
|
export const filterTags = (tagsToFilter, tagsList) => tagsList?.filter(
|
|
109
114
|
(tag) => !tagsToFilter?.includes(tag?.definition?.value)
|
|
@@ -10,7 +10,20 @@ import { connect } from 'react-redux';
|
|
|
10
10
|
import moment from 'moment';
|
|
11
11
|
import { FONT_COLOR_05 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
12
12
|
// import styled from 'styled-components';
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
CapSpin,
|
|
15
|
+
CapModal,
|
|
16
|
+
CapButton,
|
|
17
|
+
CapPopover,
|
|
18
|
+
CapInput,
|
|
19
|
+
CapTree,
|
|
20
|
+
CapSelect,
|
|
21
|
+
CapTooltip,
|
|
22
|
+
CapLink,
|
|
23
|
+
CapIcon,
|
|
24
|
+
CapRow,
|
|
25
|
+
CapLabel,
|
|
26
|
+
} from "@capillarytech/cap-ui-library";
|
|
14
27
|
import './style.scss';
|
|
15
28
|
import _ from 'lodash';
|
|
16
29
|
import { FormattedMessage, injectIntl, intlShape } from 'react-intl';
|
|
@@ -239,7 +252,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
239
252
|
window.open(TAG_TRANSLATION_DOC, '_blank');
|
|
240
253
|
}
|
|
241
254
|
render() {
|
|
242
|
-
const { hidePopover = false, tags = {}, intl = {}, moduleFilterEnabled, label, modalProps, channel } = this.props;
|
|
255
|
+
const { hidePopover = false, tags = {}, intl = {}, moduleFilterEnabled, label, modalProps, channel, fetchingSchemaError = false } = this.props;
|
|
243
256
|
const tg = tags;
|
|
244
257
|
const {formatMessage} = intl;
|
|
245
258
|
const { tagValue, expandedKeys, autoExpandParent, searchValue, visible, translationLang } = this.state;
|
|
@@ -318,13 +331,39 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
318
331
|
{contentSection}
|
|
319
332
|
</CapModal> :
|
|
320
333
|
<CapPopover
|
|
321
|
-
visible={visible}
|
|
334
|
+
visible={fetchingSchemaError ? false : visible}
|
|
322
335
|
onVisibleChange={this.togglePopoverVisibility}
|
|
323
336
|
content={contentSection}
|
|
324
337
|
trigger="click"
|
|
325
338
|
placement={translationLang === "ja-JP" && channel === 'EMAIL' ? "bottom" : "rightTop"}
|
|
339
|
+
>
|
|
340
|
+
<CapTooltip
|
|
341
|
+
title={
|
|
342
|
+
fetchingSchemaError && (
|
|
343
|
+
<CapRow className="tooltip-text-container">
|
|
344
|
+
<CapLabel className="tooltip-text1">
|
|
345
|
+
{formatMessage(messages.somethingWentWrong)}
|
|
346
|
+
</CapLabel>
|
|
347
|
+
<CapLabel className="tooltip-text2">
|
|
348
|
+
{formatMessage(messages.labelFetchErrorMsg)}
|
|
349
|
+
</CapLabel>
|
|
350
|
+
</CapRow>
|
|
351
|
+
)
|
|
352
|
+
}
|
|
353
|
+
placement="right"
|
|
326
354
|
>
|
|
327
|
-
|
|
355
|
+
<CapRow className="tooltip-add-label-container">
|
|
356
|
+
<CapButton
|
|
357
|
+
disabled={
|
|
358
|
+
this?.props?.disabled || fetchingSchemaError
|
|
359
|
+
}
|
|
360
|
+
isAddBtn
|
|
361
|
+
type="flat"
|
|
362
|
+
>
|
|
363
|
+
{label || ""}
|
|
364
|
+
</CapButton>
|
|
365
|
+
</CapRow>
|
|
366
|
+
</CapTooltip>
|
|
328
367
|
</CapPopover>
|
|
329
368
|
}
|
|
330
369
|
<CapModal
|
|
@@ -361,7 +400,8 @@ CapTagList.propTypes = {
|
|
|
361
400
|
disableTagsDetails: PropTypes.object,
|
|
362
401
|
currentOrgDetails: PropTypes.object,
|
|
363
402
|
channel: PropTypes.string,
|
|
364
|
-
disabled: PropTypes.bool
|
|
403
|
+
disabled: PropTypes.bool,
|
|
404
|
+
fetchingSchemaError: PropTypes.bool,
|
|
365
405
|
};
|
|
366
406
|
|
|
367
407
|
CapTagList.defaultValue = {
|
|
@@ -50,4 +50,12 @@ export default defineMessages({
|
|
|
50
50
|
id: `creatives.componentsV2.CapTagList.customerBarcodeDisable`,
|
|
51
51
|
defaultMessage: 'This label is not enabled for your organization. Please connect with your Capillary POC',
|
|
52
52
|
},
|
|
53
|
+
"somethingWentWrong": {
|
|
54
|
+
id: `creatives.componentsV2.CapTagList.somethingWentWrong`,
|
|
55
|
+
defaultMessage: 'Something went wrong',
|
|
56
|
+
},
|
|
57
|
+
'labelFetchErrorMsg': {
|
|
58
|
+
id: `creatives.componentsV2.CapTagList.labelFetchErrorMsg`,
|
|
59
|
+
defaultMessage: 'Unable to fetch the labels. Please try again later'
|
|
60
|
+
},
|
|
53
61
|
});
|
|
@@ -1,5 +1,26 @@
|
|
|
1
|
+
@import "~@capillarytech/cap-ui-library/styles/_variables";
|
|
2
|
+
|
|
1
3
|
@media (max-height: 25rem) {
|
|
2
4
|
.ant-tree.cap-tree-v2.ant-tree-icon-hide {
|
|
3
5
|
height: 8.5714rem;
|
|
4
6
|
}
|
|
5
7
|
}
|
|
8
|
+
|
|
9
|
+
.tooltip-add-label-container {
|
|
10
|
+
float: right;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.tooltip-text-container {
|
|
14
|
+
margin: $CAP_SPACE_12 $CAP_SPACE_20;
|
|
15
|
+
.tooltip-text1 {
|
|
16
|
+
margin-bottom: $CAP_SPACE_08;
|
|
17
|
+
font-weight: $FONT_WEIGHT_MEDIUM;
|
|
18
|
+
color: $FONT_COLOR_06;
|
|
19
|
+
font-size: $FONT_SIZE_L;
|
|
20
|
+
}
|
|
21
|
+
.tooltip-text2 {
|
|
22
|
+
font-weight: $FONT_WEIGHT_REGULAR;
|
|
23
|
+
color: $FONT_COLOR_06;
|
|
24
|
+
font-size: $FONT_SIZE_M;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -55,6 +55,7 @@ import { AI_SUGGESTION_API_URL, CONTENT_RECOMMENDATION_BOT } from './constants';
|
|
|
55
55
|
import { GET_TRANSLATION_MAPPED } from '../../containers/TagList/constants';
|
|
56
56
|
import moment from 'moment';
|
|
57
57
|
import { CUSTOMER_BARCODE_TAG , COPY_OF} from '../../containers/App/constants';
|
|
58
|
+
import { hasRemoveEmailUnsubscribeTag } from '../../utils/common';
|
|
58
59
|
const TabPane = Tabs.TabPane;
|
|
59
60
|
const {Column} = Table;
|
|
60
61
|
const {TextArea} = CapInput;
|
|
@@ -987,6 +988,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
987
988
|
if (tagValidationResponse.isBraceError){
|
|
988
989
|
errorString += this.props.intl.formatMessage(globalMessages.unbalanacedCurlyBraces);
|
|
989
990
|
}
|
|
991
|
+
if (tagValidationResponse.isContentEmpty) {
|
|
992
|
+
errorString += this.props.intl.formatMessage(messages.emailBodyEmptyError);
|
|
993
|
+
}
|
|
990
994
|
}
|
|
991
995
|
}
|
|
992
996
|
}
|
|
@@ -1125,6 +1129,8 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1125
1129
|
response.missingTags = [];
|
|
1126
1130
|
response.unsupportedTags = [];
|
|
1127
1131
|
response.isBraceError = false;
|
|
1132
|
+
response.isContentEmpty = false;
|
|
1133
|
+
const contentForValidation = isEmail ? convert(content) : content ;
|
|
1128
1134
|
if(tags && tags.length) {
|
|
1129
1135
|
_.forEach(tags, (tag) => {
|
|
1130
1136
|
_.forEach(tag.definition.supportedModules, (module) => {
|
|
@@ -1142,6 +1148,19 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1142
1148
|
let matchImg = regexImgSrc.exec(content);
|
|
1143
1149
|
const regexCustomerBarcode = /{{customer_barcode}}(?![^<]*>)/g;
|
|
1144
1150
|
let matchCustomerBarcode = regexCustomerBarcode.exec(content);
|
|
1151
|
+
// \S matches anything other than a space, a tab, a newline, or a carriage return.
|
|
1152
|
+
const validString= /\S/.test(contentForValidation);
|
|
1153
|
+
if (hasRemoveEmailUnsubscribeTag() && isEmail) {
|
|
1154
|
+
const missingTagIndex = response.missingTags.indexOf("unsubscribe");
|
|
1155
|
+
if(missingTagIndex != -1) { //skip regex tags for mandatory tags also
|
|
1156
|
+
response.missingTags.splice(missingTagIndex, 1);
|
|
1157
|
+
if (validString) {
|
|
1158
|
+
response.valid = true;
|
|
1159
|
+
} else {
|
|
1160
|
+
response.isContentEmpty = true;
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1145
1164
|
while (match !== null ) {
|
|
1146
1165
|
const tagValue = match[0].substring(this.indexOfEnd(match[0], '{{'), match[0].indexOf('}}'));
|
|
1147
1166
|
match = regex.exec(content);
|
|
@@ -1175,7 +1194,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1175
1194
|
}
|
|
1176
1195
|
}
|
|
1177
1196
|
}
|
|
1178
|
-
const contentForValidation = isEmail ? convert(content) : content ;
|
|
1179
1197
|
if(!validateIfTagClosed(contentForValidation)){
|
|
1180
1198
|
response.isBraceError = true;
|
|
1181
1199
|
response.valid = false;
|
|
@@ -86,4 +86,8 @@ export default defineMessages({
|
|
|
86
86
|
id: 'creatives.componentsV2.FormBuilder.imageReUpload',
|
|
87
87
|
defaultMessage: 'Re upload',
|
|
88
88
|
},
|
|
89
|
+
emailBodyEmptyError: {
|
|
90
|
+
id: 'creatives.componentsV2.FormBuilder.emailBodyEmptyError',
|
|
91
|
+
defaultMessage: 'Email body cannot be empty',
|
|
92
|
+
},
|
|
89
93
|
});
|
|
@@ -39,4 +39,18 @@ export const ORG_REFRESH_SEC = 10;
|
|
|
39
39
|
export const ORG_CHANGED = 'ORG_CHANGED';
|
|
40
40
|
|
|
41
41
|
export const ENABLE_AI_SUGGESTIONS = 'ENABLE_AI_SUGGESTIONS';
|
|
42
|
+
export const ERROR_IN_FETCHING_TAGS = 'Error in fetching tags';
|
|
42
43
|
|
|
44
|
+
export const GET_SUPPORT_VIDEOS_CONFIG_REQUEST =
|
|
45
|
+
'cap/GET_SUPPORT_VIDEOS_CONFIG_REQUEST';
|
|
46
|
+
export const GET_SUPPORT_VIDEOS_CONFIG_SUCCESS =
|
|
47
|
+
'cap/GET_SUPPORT_VIDEOS_CONFIG_SUCCESS';
|
|
48
|
+
export const GET_SUPPORT_VIDEOS_CONFIG_FAILURE =
|
|
49
|
+
'cap/GET_SUPPORT_VIDEOS_CONFIG_FAILURE';
|
|
50
|
+
|
|
51
|
+
export const REQUEST = 'REQUEST';
|
|
52
|
+
export const SUCCESS = 'SUCCESS';
|
|
53
|
+
export const FAILURE = 'FAILURE';
|
|
54
|
+
|
|
55
|
+
export const ENABLE_PRODUCT_SUPPORT_VIDEOS = 'ENABLE_PRODUCT_SUPPORT_VIDEOS';
|
|
56
|
+
export const DEFAULT = 'default';
|
|
@@ -12,7 +12,7 @@ import moment from 'moment';
|
|
|
12
12
|
import { GA, multipleOrgSwitch, utilsSessionStorageApi, Auth } from '@capillarytech/cap-ui-utils';
|
|
13
13
|
import { injectIntl, FormattedMessage, intlShape, FormattedHTMLMessage } from 'react-intl';
|
|
14
14
|
import messages from './messages';
|
|
15
|
-
import { makeSelectAuthenticated, makeSelectUser } from './selectors';
|
|
15
|
+
import { makeSelectAuthenticated, makeSelectUser, makeSelectDemoVideoAndLink } from './selectors';
|
|
16
16
|
import * as actions from './actions';
|
|
17
17
|
import * as locationActions from '../LanguageProvider/actions';
|
|
18
18
|
import * as appActions from '../App/actions';
|
|
@@ -21,11 +21,16 @@ import NavigationBar from '../../v2Components/NavigationBar';
|
|
|
21
21
|
import { engagePlusPublicPath, publicPath } from '../../config/path';
|
|
22
22
|
import { GTM_TRACKING_ID, CREATIVES_UI_VIEW, FAILURE } from '../App/constants';
|
|
23
23
|
import { makeSelectLocale } from '../../v2Containers/LanguageProvider/selectors';
|
|
24
|
+
import CapSupportVideosWrapper from '@capillarytech/cap-ui-library/CapSupportVideosWrapper';
|
|
25
|
+
import { replaceDynamicAndCompare } from '@capillarytech/cap-ui-library/CapSupportVideosWrapper/utils';
|
|
24
26
|
import {
|
|
25
27
|
ORG_SETTINGS_URL,
|
|
26
28
|
CAMPAIGN_SETTINGS_URL,
|
|
27
29
|
ORG_REFRESH_SEC,
|
|
28
30
|
ORG_CHANGED,
|
|
31
|
+
REQUEST,
|
|
32
|
+
DEFAULT,
|
|
33
|
+
ENABLE_PRODUCT_SUPPORT_VIDEOS,
|
|
29
34
|
} from './constants';
|
|
30
35
|
import './_cap.scss';
|
|
31
36
|
const gtm = window.dataLayer || [];
|
|
@@ -109,7 +114,7 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
109
114
|
}
|
|
110
115
|
locale = this.getMappedLocale(locale);
|
|
111
116
|
//locale = 'zh';
|
|
112
|
-
|
|
117
|
+
this.props.actions.getSupportVideosConfig();
|
|
113
118
|
moment.locale(locale);
|
|
114
119
|
window.addEventListener('storage', this.handleStorageChange, false);
|
|
115
120
|
document.addEventListener(
|
|
@@ -413,6 +418,46 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
413
418
|
this.setState({ showOrgChangeModal: false });
|
|
414
419
|
};
|
|
415
420
|
|
|
421
|
+
renderNavigationComponent(component) {
|
|
422
|
+
const { demoVideoAndLinkJSONData: {
|
|
423
|
+
demoVideoAndLinkJSON = {},
|
|
424
|
+
demoVideoAndLinkJSONStatus,
|
|
425
|
+
} = {},
|
|
426
|
+
Global,
|
|
427
|
+
} = this.props;
|
|
428
|
+
const { currentOrgDetails = {}, user = {} } =
|
|
429
|
+
Global || {};
|
|
430
|
+
const { lang: userLocale = '' } = user;
|
|
431
|
+
let wrapperComponent = <>{component}</>;
|
|
432
|
+
const {
|
|
433
|
+
basicDetails: { base_language: orgLocale = '' } = {},
|
|
434
|
+
accessibleFeatures = [],
|
|
435
|
+
} = currentOrgDetails || {};
|
|
436
|
+
if (
|
|
437
|
+
accessibleFeatures.includes(
|
|
438
|
+
ENABLE_PRODUCT_SUPPORT_VIDEOS
|
|
439
|
+
) &&
|
|
440
|
+
demoVideoAndLinkJSON?.is_active &&
|
|
441
|
+
demoVideoAndLinkJSONStatus !== REQUEST
|
|
442
|
+
) {
|
|
443
|
+
const demoLocale = userLocale || orgLocale || DEFAULT;
|
|
444
|
+
const JSONInContext = demoVideoAndLinkJSON?.json_config;
|
|
445
|
+
const currentPathJSON = JSONInContext?.find((routeEle) =>
|
|
446
|
+
replaceDynamicAndCompare(location?.pathname, routeEle?.route),
|
|
447
|
+
);
|
|
448
|
+
const targetElements = currentPathJSON?.target_elements || {};
|
|
449
|
+
wrapperComponent = (
|
|
450
|
+
<CapSupportVideosWrapper
|
|
451
|
+
targetElements={targetElements}
|
|
452
|
+
locale={demoLocale}
|
|
453
|
+
>
|
|
454
|
+
{component}
|
|
455
|
+
</CapSupportVideosWrapper>
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
return wrapperComponent;
|
|
459
|
+
}
|
|
460
|
+
|
|
416
461
|
render() {
|
|
417
462
|
const { Global, location } = this.props;
|
|
418
463
|
const { topbarMenuData, isLoggedIn, currentOrgDetails = {}, getUserDataStatus, getUserDataCode } = Global;
|
|
@@ -444,6 +489,7 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
444
489
|
<CapSomethingWentWrong url={`${window.location.origin}${publicPath}v2`} />
|
|
445
490
|
}
|
|
446
491
|
{isLoggedIn && type !== 'embedded' ?
|
|
492
|
+
this.renderNavigationComponent(
|
|
447
493
|
<NavigationBar
|
|
448
494
|
userData={Global}
|
|
449
495
|
changeOrg={this.changeOrg}
|
|
@@ -455,7 +501,7 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
455
501
|
topbarMenuData={topbarMenuDataOptions}
|
|
456
502
|
location={location}
|
|
457
503
|
campaignOrgV2Status={currentOrgDetails.org_campaign_v2_status}
|
|
458
|
-
|
|
504
|
+
/>) : ''}
|
|
459
505
|
<div className="main" style={{minHeight: 'calc(100vh - 74px', position: 'relative', top: '74px'}}>
|
|
460
506
|
|
|
461
507
|
<div className="main-content">
|
|
@@ -488,12 +534,14 @@ Cap.propTypes = {
|
|
|
488
534
|
locationActions: PropTypes.object,
|
|
489
535
|
location: PropTypes.object,
|
|
490
536
|
intl: intlShape.isRequired,
|
|
537
|
+
demoVideoAndLinkJSONData: PropTypes.object,
|
|
491
538
|
};
|
|
492
539
|
|
|
493
540
|
const mapStateToProps = createStructuredSelector({
|
|
494
541
|
Global: makeSelectAuthenticated(),
|
|
495
542
|
User: makeSelectUser(),
|
|
496
543
|
loader: makeSelectLocale(),
|
|
544
|
+
demoVideoAndLinkJSONData: makeSelectDemoVideoAndLink(),
|
|
497
545
|
});
|
|
498
546
|
|
|
499
547
|
function mapDispatchToProps(dispatch) {
|
|
@@ -79,10 +79,12 @@ function capReducer(state = fromJS(initialState.cap), action) {
|
|
|
79
79
|
.set('getUserDataCode', action.status);
|
|
80
80
|
case types.GET_SCHEMA_FOR_ENTITY_REQUEST:
|
|
81
81
|
return state
|
|
82
|
-
.set('fetchingSchema', true)
|
|
82
|
+
.set('fetchingSchema', true)
|
|
83
|
+
.set('fetchingSchemaError', false);
|
|
83
84
|
case types.GET_SCHEMA_FOR_ENTITY_FAILURE:
|
|
84
85
|
return state
|
|
85
|
-
.set('fetchingSchema', false)
|
|
86
|
+
.set('fetchingSchema', false)
|
|
87
|
+
.set('fetchingSchemaError', true);
|
|
86
88
|
case types.GET_SCHEMA_FOR_ENTITY_SUCCESS: {
|
|
87
89
|
const stateMeta = state.get('metaEntities');
|
|
88
90
|
return state
|
|
@@ -90,7 +92,8 @@ function capReducer(state = fromJS(initialState.cap), action) {
|
|
|
90
92
|
.set('metaEntities', {
|
|
91
93
|
layouts: action.data && action.entityType === 'LAYOUT' ? action.data.metaEntities : stateMeta.layouts,
|
|
92
94
|
tags: action.data && action.entityType === 'TAG' ? action.data.metaEntities : stateMeta.tags,
|
|
93
|
-
})
|
|
95
|
+
})
|
|
96
|
+
.set('fetchingSchemaError', false);
|
|
94
97
|
}
|
|
95
98
|
case types.CLEAR_META_ENTITIES:
|
|
96
99
|
return state.set('metaEntities', {
|
|
@@ -124,6 +127,18 @@ function capReducer(state = fromJS(initialState.cap), action) {
|
|
|
124
127
|
.set('tagsToDisable', action.tagsToDisable)
|
|
125
128
|
.set('parentTagsToDisable', action.parentTagsToDisable);
|
|
126
129
|
}
|
|
130
|
+
case types.GET_SUPPORT_VIDEOS_CONFIG_REQUEST:
|
|
131
|
+
return state
|
|
132
|
+
.set('demoVideoAndLinkJSONStatus', types.REQUEST)
|
|
133
|
+
.set('demoVideoAndLinkJSON', {});
|
|
134
|
+
case types.GET_SUPPORT_VIDEOS_CONFIG_SUCCESS:
|
|
135
|
+
return state
|
|
136
|
+
.set('demoVideoAndLinkJSONStatus', types.SUCCESS)
|
|
137
|
+
.set('demoVideoAndLinkJSON', action?.result);
|
|
138
|
+
case types.GET_SUPPORT_VIDEOS_CONFIG_FAILURE:
|
|
139
|
+
return state
|
|
140
|
+
.set('demoVideoAndLinkJSONStatus', types.FAILURE)
|
|
141
|
+
.set('demoVideoAndLinkJSONError', action?.error);
|
|
127
142
|
default:
|
|
128
143
|
return state;
|
|
129
144
|
}
|
|
@@ -125,9 +125,28 @@ export function* fetchSchemaForEntity(queryParams) {
|
|
|
125
125
|
const result = yield call(Api.fetchSchemaForEntity, queryParams);
|
|
126
126
|
|
|
127
127
|
// const sidebar = result.response.sidebar;
|
|
128
|
-
|
|
128
|
+
const {
|
|
129
|
+
success = false,
|
|
130
|
+
response = {},
|
|
131
|
+
status: {
|
|
132
|
+
code = '',
|
|
133
|
+
} = {},
|
|
134
|
+
} = result || {};
|
|
135
|
+
const {
|
|
136
|
+
metaEntities = [],
|
|
137
|
+
} = response || {};
|
|
138
|
+
const {
|
|
139
|
+
queryParams: {
|
|
140
|
+
type = '',
|
|
141
|
+
} = {},
|
|
142
|
+
} = queryParams || {};
|
|
143
|
+
if (success || metaEntities?.length) {
|
|
144
|
+
yield put({ type: types.GET_SCHEMA_FOR_ENTITY_SUCCESS, data: response, statusCode: code, entityType: type });
|
|
145
|
+
} else {
|
|
146
|
+
yield put({ type: types.GET_SCHEMA_FOR_ENTITY_FAILURE, error: true });
|
|
147
|
+
}
|
|
129
148
|
} catch (error) {
|
|
130
|
-
yield put({ type: types.GET_SCHEMA_FOR_ENTITY_FAILURE, error
|
|
149
|
+
yield put({ type: types.GET_SCHEMA_FOR_ENTITY_FAILURE, error});
|
|
131
150
|
}
|
|
132
151
|
}
|
|
133
152
|
|
|
@@ -152,6 +171,25 @@ function* getTopbarMenuData(params) {
|
|
|
152
171
|
}
|
|
153
172
|
}
|
|
154
173
|
|
|
174
|
+
export function* getSupportVideosConfig({ callback }) {
|
|
175
|
+
try {
|
|
176
|
+
const response = yield call(Api.getSupportVideosConfig);
|
|
177
|
+
if (response?.success) {
|
|
178
|
+
yield put({
|
|
179
|
+
type: types.GET_SUPPORT_VIDEOS_CONFIG_SUCCESS,
|
|
180
|
+
result: response?.data || {},
|
|
181
|
+
});
|
|
182
|
+
} else {
|
|
183
|
+
yield put({
|
|
184
|
+
type: types.GET_SUPPORT_VIDEOS_CONFIG_FAILURE,
|
|
185
|
+
error: response?.message,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
if (callback) callback(response);
|
|
189
|
+
} catch (error) {
|
|
190
|
+
yield put({ type: types.GET_SUPPORT_VIDEOS_CONFIG_FAILURE, error });
|
|
191
|
+
}
|
|
192
|
+
}
|
|
155
193
|
|
|
156
194
|
function* watchFetchSchemaForEntity() {
|
|
157
195
|
const watcher = yield takeLatest(types.GET_SCHEMA_FOR_ENTITY_REQUEST, fetchSchemaForEntity);
|
|
@@ -176,6 +214,13 @@ function* watchGetTopbarMenuData() {
|
|
|
176
214
|
yield takeLatest(types.GET_TOPBAR_MENU_DATA_REQUEST, getTopbarMenuData);
|
|
177
215
|
}
|
|
178
216
|
|
|
217
|
+
export function* watchForGetVideosConfig() {
|
|
218
|
+
yield takeLatest(
|
|
219
|
+
types.GET_SUPPORT_VIDEOS_CONFIG_REQUEST,
|
|
220
|
+
getSupportVideosConfig,
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
|
|
179
224
|
export default [
|
|
180
225
|
loginFlow,
|
|
181
226
|
watchForOrgChange,
|
|
@@ -183,5 +228,6 @@ export default [
|
|
|
183
228
|
watchForFetchUserInfo,
|
|
184
229
|
watchFetchSchemaForEntity,
|
|
185
230
|
watchGetTopbarMenuData,
|
|
231
|
+
watchForGetVideosConfig,
|
|
186
232
|
];
|
|
187
233
|
|
|
@@ -73,6 +73,11 @@ const makeSelectFetchingSchema = () => createSelector(
|
|
|
73
73
|
(globalState) => globalState.get('fetchingSchema')
|
|
74
74
|
);
|
|
75
75
|
|
|
76
|
+
const makeSelectFetchingSchemaError = () => createSelector(
|
|
77
|
+
selectCapDomain,
|
|
78
|
+
(globalState) => globalState.get('fetchingSchemaError')
|
|
79
|
+
);
|
|
80
|
+
|
|
76
81
|
const makeSelectLoyaltyPromotionDisplay = () => createSelector(
|
|
77
82
|
selectCapDomain,
|
|
78
83
|
(globalState) => ({
|
|
@@ -82,6 +87,13 @@ const makeSelectLoyaltyPromotionDisplay = () => createSelector(
|
|
|
82
87
|
}),
|
|
83
88
|
);
|
|
84
89
|
|
|
90
|
+
const makeSelectDemoVideoAndLink = () =>
|
|
91
|
+
createSelector(selectCapDomain, (substate) => ({
|
|
92
|
+
demoVideoAndLinkJSON: substate.get('demoVideoAndLinkJSON'),
|
|
93
|
+
demoVideoAndLinkJSONStatus: substate.get('demoVideoAndLinkJSONStatus'),
|
|
94
|
+
demoVideoAndLinkJSONError: substate.get('demoVideoAndLinkJSONError'),
|
|
95
|
+
}));
|
|
96
|
+
|
|
85
97
|
export {
|
|
86
98
|
makeSelectLocationState,
|
|
87
99
|
makeSelectAuthenticated,
|
|
@@ -94,4 +106,6 @@ export {
|
|
|
94
106
|
makeSelectFetchingSchema,
|
|
95
107
|
setInjectedTags,
|
|
96
108
|
makeSelectLoyaltyPromotionDisplay,
|
|
109
|
+
makeSelectFetchingSchemaError,
|
|
110
|
+
makeSelectDemoVideoAndLink,
|
|
97
111
|
};
|