@capillarytech/creatives-library 7.17.115 → 7.17.117

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.
@@ -16,6 +16,7 @@ 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_WECHAT = 'ENABLE_WECHAT';
18
18
  export const ENABLE_CUSTOMER_BARCODE_TAG = "ENABLE_CUSTOMER_BARCODE_TAG";
19
+ export const EMAIL_UNSUBSCRIBE_TAG_MANDATORY = "EMAIL_UNSUBSCRIBE_TAG_MANDATORY";
19
20
 
20
21
  export const CARD_RELATED_TAGS = [
21
22
  'card_series',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.17.115",
4
+ "version": "7.17.117",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -84,14 +84,11 @@
84
84
  }
85
85
 
86
86
  .contet-width-collapse {
87
- margin-left: 17.438rem;
88
- .component-wrapper {
89
- max-width: 70.063rem;
90
- }
87
+ margin-left: 17rem;
91
88
  }
92
89
 
93
90
  .content-width-expanded {
94
- margin-left: 8.375rem;
91
+ margin-left: 4.475rem;
95
92
  }
96
93
 
97
94
  .breadcrumbs{
package/utils/common.js CHANGED
@@ -18,6 +18,7 @@ import {
18
18
  ENABLE_CUSTOMER_BARCODE_TAG,
19
19
  BADGES_UI_ENABLED,
20
20
  BADGES_ENROLL,
21
+ EMAIL_UNSUBSCRIBE_TAG_MANDATORY,
21
22
  BADGES_ISSUE,
22
23
  ENABLE_WECHAT,
23
24
  } from '../containers/App/constants';
@@ -112,6 +113,10 @@ export const hasCustomerBarcodeFeatureEnabled = Auth.hasFeatureAccess.bind(
112
113
  ENABLE_CUSTOMER_BARCODE_TAG,
113
114
  );
114
115
 
116
+ export const isEmailUnsubscribeTagMandatory = Auth.hasFeatureAccess.bind(
117
+ null,
118
+ EMAIL_UNSUBSCRIBE_TAG_MANDATORY,
119
+ );
115
120
  //filtering tags based on scope
116
121
  export const filterTags = (tagsToFilter, tagsList) => tagsList?.filter(
117
122
  (tag) => !tagsToFilter?.includes(tag?.definition?.value)
@@ -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 { isEmailUnsubscribeTagMandatory } from '../../utils/common';
58
59
  const TabPane = Tabs.TabPane;
59
60
  const {Column} = Table;
60
61
  const {TextArea} = CapInput;
@@ -989,6 +990,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
989
990
  if (tagValidationResponse.isBraceError){
990
991
  errorString += this.props.intl.formatMessage(globalMessages.unbalanacedCurlyBraces);
991
992
  }
993
+ if (tagValidationResponse?.isContentEmpty) {
994
+ errorString += this.props.intl.formatMessage(messages.emailBodyEmptyError);
995
+ }
992
996
  }
993
997
  }
994
998
  }
@@ -1127,6 +1131,8 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1127
1131
  response.missingTags = [];
1128
1132
  response.unsupportedTags = [];
1129
1133
  response.isBraceError = false;
1134
+ response.isContentEmpty = false;
1135
+ const contentForValidation = isEmail ? convert(content) : content ;
1130
1136
  if(tags && tags.length) {
1131
1137
  _.forEach(tags, (tag) => {
1132
1138
  _.forEach(tag.definition.supportedModules, (module) => {
@@ -1144,6 +1150,19 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1144
1150
  let matchImg = regexImgSrc.exec(content);
1145
1151
  const regexCustomerBarcode = /{{customer_barcode}}(?![^<]*>)/g;
1146
1152
  let matchCustomerBarcode = regexCustomerBarcode.exec(content);
1153
+ // \S matches anything other than a space, a tab, a newline, or a carriage return.
1154
+ const validString= /\S/.test(contentForValidation);
1155
+ if (isEmailUnsubscribeTagMandatory() && isEmail) {
1156
+ const missingTagIndex = response?.missingTags?.indexOf("unsubscribe");
1157
+ if(missingTagIndex != -1) { //skip regex tags for mandatory tags also
1158
+ response?.missingTags?.splice(missingTagIndex, 1);
1159
+ if (validString) {
1160
+ response.valid = true;
1161
+ } else {
1162
+ response.isContentEmpty = true;
1163
+ }
1164
+ }
1165
+ }
1147
1166
  while (match !== null ) {
1148
1167
  const tagValue = match[0].substring(this.indexOfEnd(match[0], '{{'), match[0].indexOf('}}'));
1149
1168
  match = regex.exec(content);
@@ -1177,7 +1196,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1177
1196
  }
1178
1197
  }
1179
1198
  }
1180
- const contentForValidation = isEmail ? convert(content) : content ;
1181
1199
  if(!validateIfTagClosed(contentForValidation)){
1182
1200
  response.isBraceError = true;
1183
1201
  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
  });
@@ -1,11 +1,9 @@
1
1
  export const CapLeftNavigationCss = {
2
- 'padding-right': '1.28rem',
3
- "width": '71.25rem',
4
- 'margin-left': '14.9rem',
2
+ 'width': '75.770rem',
3
+ 'margin-left': 'calc((100vw - 70.063rem)/2 + 1.6rem)',
5
4
  };
6
5
 
7
6
  export const CapLeftNavigatioOpenCss = {
8
- 'padding-left': '0',
9
- "width": '70.063rem',
10
- 'margin-left': '18.5rem',
7
+ 'width': '71.063rem',
8
+ 'margin-left': 'calc((100vw - 70.063rem)/2 + 8rem)',
11
9
  };
@@ -62,6 +62,12 @@ const MainWrapper = styled.div`
62
62
  top: ${(props) => (props.isLatestLeftNavigationEnabled ? '1.72rem' : '5.29rem')};
63
63
  `;
64
64
 
65
+ const ContentWrapper = styled.div`
66
+ && {
67
+ margin-left: ${(props) => (props.isLatestLeftNavigationEnabled ? (props.leftNavbarExpanded ? '17rem' : '4.475rem') : 0)};
68
+ }
69
+ `;
70
+
65
71
  export class Cap extends React.Component { // eslint-disable-line react/prefer-stateless-function
66
72
 
67
73
  constructor(props) {
@@ -519,9 +525,13 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
519
525
  />) : ''}
520
526
  <MainWrapper isLatestLeftNavigationEnabled={isLatestLeftNavigationEnabled} className="main">
521
527
 
522
- <div className={`main-content ${this.state.leftNavbarExpanded ? "contet-width-collapse" : "content-width-expanded"}`}>
528
+ <ContentWrapper
529
+ className={`main-content ${this.state.leftNavbarExpanded ? "contet-width-collapse" : "content-width-expanded"}`}
530
+ isLatestLeftNavigationEnabled={isLatestLeftNavigationEnabled}
531
+ leftNavbarExpanded={this.state.leftNavbarExpanded}
532
+ >
523
533
  {React.Children.toArray(this.props.children)}
524
- </div>
534
+ </ContentWrapper>
525
535
  </MainWrapper>
526
536
  </div>
527
537
  {(toastMessages && toastMessages.length > 0) &&
@@ -11,6 +11,7 @@ export default css`
11
11
  .component-wrapper {
12
12
  ${(props) => props.isFullMode ? `
13
13
  max-width: 1140px;
14
+ margin: 0 auto;
14
15
  width: 100%;
15
16
  padding: ${CAP_SPACE_24} 0;
16
17
  .ant-tabs-content{