@capillarytech/creatives-library 7.17.57-alpha.0 → 7.17.58
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 +0 -15
- package/package.json +1 -1
- package/utils/common.js +0 -7
- package/v2Components/FormBuilder/constants.js +1 -0
- package/v2Components/FormBuilder/index.js +6 -7
- package/v2Containers/TagList/index.js +2 -6
- package/v2Containers/ChannelTemplates/actions.js +0 -20
- package/v2Containers/ChannelTemplates/constants.js +0 -8
- package/v2Containers/ChannelTemplates/index.js +0 -47
- package/v2Containers/ChannelTemplates/messages.js +0 -13
- package/v2Containers/ChannelTemplates/reducer.js +0 -34
- package/v2Containers/ChannelTemplates/sagas.js +0 -32
- package/v2Containers/ChannelTemplates/selectors.js +0 -25
|
@@ -12,7 +12,6 @@ export const PROMO_ENGINE = 'PROMO_ENGINE';
|
|
|
12
12
|
export const CUSTOM_TAG = 'CustomTagMessage';
|
|
13
13
|
export const CUSTOMER_EXTENDED_FIELD = 'Customer extended fields';
|
|
14
14
|
export const EXTENDED_TAG = 'ExtendedTagMessage';
|
|
15
|
-
export const BADGES_UI_ENABLED = 'BADGES_UI_ENABLED';
|
|
16
15
|
export const JP_LOCALE_HIDE_FEATURE = 'JP_LOCALE_HIDE_FEATURE';
|
|
17
16
|
export const ENABLE_CUSTOMER_BARCODE_TAG = "ENABLE_CUSTOMER_BARCODE_TAG";
|
|
18
17
|
|
|
@@ -71,19 +70,5 @@ export const PROMO_ENGINE_RELATED_TAGS = [
|
|
|
71
70
|
"promotion_expiry_date",
|
|
72
71
|
];
|
|
73
72
|
|
|
74
|
-
export const BADGES_RELATED_TAGS = [
|
|
75
|
-
"Badge",
|
|
76
|
-
"Badge_expiry_date",
|
|
77
|
-
"badge_expiry_mm_slash_dd_slash_yyyy",
|
|
78
|
-
"badge_expiry_dd_slash_mm_slash_yyyy",
|
|
79
|
-
"badge_expiry_yyyy_hyphen_mm_hyphen_dd",
|
|
80
|
-
"badge_expiry_mm_slash_dd_slash_yy",
|
|
81
|
-
"badge_expiry_dd_space_Mon_space_yyyy",
|
|
82
|
-
"badge_expiry_Day_comma_space_Mon_space_dd_comma_space_yy",
|
|
83
|
-
"badge_expiry_Dd_dot_mm_dot_yy",
|
|
84
|
-
"badge_expiry_dd_space_Mon",
|
|
85
|
-
"Days_until_expiry",
|
|
86
|
-
];
|
|
87
|
-
|
|
88
73
|
export const CUSTOMER_BARCODE_TAG = "customer_barcode";
|
|
89
74
|
export const COPY_OF = "Copy of";
|
package/package.json
CHANGED
package/utils/common.js
CHANGED
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
REGISTRATION_CUSTOM_FIELD,
|
|
16
16
|
JP_LOCALE_HIDE_FEATURE,
|
|
17
17
|
ENABLE_CUSTOMER_BARCODE_TAG,
|
|
18
|
-
BADGES_UI_ENABLED,
|
|
19
18
|
} from '../containers/App/constants';
|
|
20
19
|
import { apiMessageFormatHandler } from './commonUtils';
|
|
21
20
|
|
|
@@ -78,12 +77,6 @@ export const hasGiftVoucherFeature = Auth.hasFeatureAccess.bind(
|
|
|
78
77
|
null,
|
|
79
78
|
GIFT_CARDS,
|
|
80
79
|
);
|
|
81
|
-
|
|
82
|
-
export const hasBadgesFeature = Auth.hasFeatureAccess.bind(
|
|
83
|
-
null,
|
|
84
|
-
BADGES_UI_ENABLED
|
|
85
|
-
);
|
|
86
|
-
|
|
87
80
|
export const hasJPLocaleHideFeatureEnabled = Auth.hasFeatureAccess.bind(
|
|
88
81
|
null,
|
|
89
82
|
JP_LOCALE_HIDE_FEATURE,
|
|
@@ -29,7 +29,7 @@ import CapUploader from '@capillarytech/cap-ui-library/CapUploader';
|
|
|
29
29
|
import CapHeading from '@capillarytech/cap-ui-library/CapHeading';
|
|
30
30
|
import CapIcon from '@capillarytech/cap-ui-library/CapIcon';
|
|
31
31
|
import CapTooltip from '@capillarytech/cap-ui-library/CapTooltip';
|
|
32
|
-
import
|
|
32
|
+
import CapAskAira from '@capillarytech/cap-ui-library/CapAskAira';
|
|
33
33
|
|
|
34
34
|
import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
|
|
35
35
|
import LabelHOC from '@capillarytech/cap-ui-library/assets/HOCs/ComponentWithLabelHOC';
|
|
@@ -51,7 +51,7 @@ import { SMS, MOBILE_PUSH, LINE, ENABLE_AI_SUGGESTIONS } from '../../v2Container
|
|
|
51
51
|
import { validateIfTagClosed } from '../../utils/tagValidations';
|
|
52
52
|
import globalMessages from '../../v2Containers/Cap/messages';
|
|
53
53
|
import { convert } from 'html-to-text';
|
|
54
|
-
import { AI_SUGGESTION_API_URL } from './constants';
|
|
54
|
+
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';
|
|
@@ -2313,10 +2313,8 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2313
2313
|
const { formatMessage } = this.props.intl;
|
|
2314
2314
|
|
|
2315
2315
|
const { accessibleFeatures = [] } = this.props.currentOrgDetails || {};
|
|
2316
|
-
const hasAiSuggestionsEnabled =
|
|
2317
|
-
|
|
2318
|
-
);
|
|
2319
|
-
|
|
2316
|
+
const hasAiSuggestionsEnabled = true;
|
|
2317
|
+
|
|
2320
2318
|
let errorMessageText = false;
|
|
2321
2319
|
switch (errorType) {
|
|
2322
2320
|
case MISSING_TAG_ERROR:
|
|
@@ -2356,11 +2354,12 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2356
2354
|
&& hasAiSuggestionsEnabled
|
|
2357
2355
|
&& this.props.isFullMode
|
|
2358
2356
|
&& (
|
|
2359
|
-
<
|
|
2357
|
+
<CapAskAira
|
|
2360
2358
|
text={messageContent || ""}
|
|
2361
2359
|
setText={(x) => {
|
|
2362
2360
|
this.updateFormData(x, val);
|
|
2363
2361
|
}}
|
|
2362
|
+
botType={CONTENT_RECOMMENDATION_BOT}
|
|
2364
2363
|
websocketUrl={AI_SUGGESTION_API_URL}
|
|
2365
2364
|
/>
|
|
2366
2365
|
)}
|
|
@@ -22,8 +22,8 @@ import './_tagList.scss';
|
|
|
22
22
|
import { selectCurrentOrgDetails } from '../Cap/selectors';
|
|
23
23
|
import { injectIntl } from 'react-intl';
|
|
24
24
|
import { scope } from './messages';
|
|
25
|
-
import { handleInjectedData, hasGiftVoucherFeature, hasPromoFeature
|
|
26
|
-
import { GIFT_VOUCHER_RELATED_TAGS, PROMO_ENGINE_RELATED_TAGS
|
|
25
|
+
import { handleInjectedData, hasGiftVoucherFeature, hasPromoFeature } from '../../utils/common';
|
|
26
|
+
import { GIFT_VOUCHER_RELATED_TAGS, PROMO_ENGINE_RELATED_TAGS } from '../../containers/App/constants';
|
|
27
27
|
|
|
28
28
|
const TreeNode = Tree.TreeNode;
|
|
29
29
|
|
|
@@ -105,10 +105,6 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
105
105
|
//filtering GIFT_VOUCHER_RELATED_TAGS if org does not have GIFT_CARDS feature enabled
|
|
106
106
|
excludedTags.push(...GIFT_VOUCHER_RELATED_TAGS);
|
|
107
107
|
}
|
|
108
|
-
if (!hasBadgesFeature()) {
|
|
109
|
-
//filtering BADGES_RELATED_TAGS if org does not have BADGES feature enabled
|
|
110
|
-
excludedTags.push(...BADGES_RELATED_TAGS);
|
|
111
|
-
}
|
|
112
108
|
//Form tags object with tag headers
|
|
113
109
|
_.forEach(tagsList, (temp) => {
|
|
114
110
|
const tag = temp.definition;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* ChannelTemplates actions
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import * as types from './constants';
|
|
8
|
-
|
|
9
|
-
export function defaultAction() {
|
|
10
|
-
return {
|
|
11
|
-
type: types.DEFAULT_ACTION,
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function getTemplates(channel) {
|
|
16
|
-
return {
|
|
17
|
-
type: types.GET_TEMPLATES_REQUEST,
|
|
18
|
-
channel,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* ChannelTemplates
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
|
-
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import { connect } from 'react-redux';
|
|
11
|
-
import { FormattedMessage } from 'react-intl';
|
|
12
|
-
import { bindActionCreators } from 'redux';
|
|
13
|
-
import { createStructuredSelector } from 'reselect';
|
|
14
|
-
import makeSelectChannelTemplates from './selectors';
|
|
15
|
-
import * as actions from './actions';
|
|
16
|
-
import messages from './messages';
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export class ChannelTemplates extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
20
|
-
componentDidMount() {
|
|
21
|
-
this.props.actions.getTemplates(this.props.channel);
|
|
22
|
-
}
|
|
23
|
-
render() {
|
|
24
|
-
return (
|
|
25
|
-
<CardGrid
|
|
26
|
-
cardDataList={[]}
|
|
27
|
-
/>
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
ChannelTemplates.propTypes = {
|
|
33
|
-
actions: PropTypes.object.isRequired,
|
|
34
|
-
channel: PropTypes.string,
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const mapStateToProps = createStructuredSelector({
|
|
38
|
-
ChannelTemplates: makeSelectChannelTemplates(),
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
function mapDispatchToProps(dispatch) {
|
|
42
|
-
return {
|
|
43
|
-
actions: bindActionCreators(actions, dispatch),
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export default connect(mapStateToProps, mapDispatchToProps)(ChannelTemplates);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* ChannelTemplates Messages
|
|
3
|
-
*
|
|
4
|
-
* This contains all the text for the ChannelTemplates component.
|
|
5
|
-
*/
|
|
6
|
-
import { defineMessages } from 'react-intl';
|
|
7
|
-
|
|
8
|
-
export default defineMessages({
|
|
9
|
-
header: {
|
|
10
|
-
id: 'creatives.containersV2.ChannelTemplates.header',
|
|
11
|
-
defaultMessage: 'This is ChannelTemplates container !',
|
|
12
|
-
},
|
|
13
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* ChannelTemplates reducer
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { fromJS } from 'immutable';
|
|
8
|
-
import * as types from './constants';
|
|
9
|
-
|
|
10
|
-
const initialState = fromJS({
|
|
11
|
-
loadingTemplates: true,
|
|
12
|
-
smsTemplates: [],
|
|
13
|
-
emailTemplates: [],
|
|
14
|
-
wechatTemplates: [],
|
|
15
|
-
mobilepushTemplates: [],
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
function channelTemplatesReducer(state = initialState, action) {
|
|
19
|
-
const channelTemplates = `${action.channel}Templates`;
|
|
20
|
-
switch (action.type) {
|
|
21
|
-
case types.DEFAULT_ACTION:
|
|
22
|
-
return state;
|
|
23
|
-
case types.GET_TEMPLATES_REQUEST:
|
|
24
|
-
return state.set('loadingTemplates', true);
|
|
25
|
-
case types.GET_TEMPLATES_SUCESS:
|
|
26
|
-
return state.set('loadingTemplates', false).set(channelTemplates, action.templates);
|
|
27
|
-
case types.GET_TEMPLATES_FAILURE:
|
|
28
|
-
return state.set('loadingTemplates', false).set('error', action.error);
|
|
29
|
-
default:
|
|
30
|
-
return state;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export default channelTemplatesReducer;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { take, takeLatest, call, put, cancel } from 'redux-saga/effects';
|
|
2
|
-
import { LOCATION_CHANGE } from 'react-router-redux';
|
|
3
|
-
import * as Api from '../../services/api';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import * as types from './constants';
|
|
7
|
-
// Individual exports for testing
|
|
8
|
-
export function* defaultSaga() {
|
|
9
|
-
// See example in v2Containers/HomePage/sagas.js
|
|
10
|
-
}
|
|
11
|
-
function* getTemplates(action) {
|
|
12
|
-
try {
|
|
13
|
-
const req = {
|
|
14
|
-
channel: action.channel,
|
|
15
|
-
queryParams: action.query,
|
|
16
|
-
};
|
|
17
|
-
const res = call(Api.getAllTemplates, req);
|
|
18
|
-
put({type: types.GET_TEMPLATES_SUCESS, templates: res.response, channel: action.channel});
|
|
19
|
-
} catch (error) {
|
|
20
|
-
put({type: types.GET_TEMPLATES_FAILURE, error});
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
function* getTemplatesWatcher() {
|
|
24
|
-
const watcher = yield takeLatest(types.GET_TEMPLATES_REQUEST, getTemplates);
|
|
25
|
-
yield take(LOCATION_CHANGE);
|
|
26
|
-
yield cancel(watcher);
|
|
27
|
-
}
|
|
28
|
-
// All sagas to be loaded
|
|
29
|
-
export default [
|
|
30
|
-
defaultSaga,
|
|
31
|
-
getTemplatesWatcher,
|
|
32
|
-
];
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { createSelector } from 'reselect';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Direct selector to the channelTemplates state domain
|
|
5
|
-
*/
|
|
6
|
-
const selectChannelTemplatesDomain = () => (state) => state.get('templates');
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Other specific selectors
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Default selector used by ChannelTemplates
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
const makeSelectChannelTemplates = () => createSelector(
|
|
18
|
-
selectChannelTemplatesDomain(),
|
|
19
|
-
(substate) => substate.toJS()
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
export default makeSelectChannelTemplates;
|
|
23
|
-
export {
|
|
24
|
-
selectChannelTemplatesDomain,
|
|
25
|
-
};
|