@capillarytech/creatives-library 7.17.164 → 7.17.165

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.17.164",
4
+ "version": "7.17.165",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -140,19 +140,6 @@ export class NavigationBar extends React.Component {
140
140
  }
141
141
  };
142
142
 
143
- productSelection = () => {
144
- const { location, intl: { formatMessage } } = this.props;
145
- const { pathname } = location;
146
- const parentModule = pathname.substring(pathname.lastIndexOf('/') + 1);
147
- switch (parentModule) {
148
- case LOYALTY:
149
- return formatMessage(messages.loyaltyProgram);
150
- default:
151
- return formatMessage(messages.selectedProductDefault)
152
-
153
- }
154
- }
155
-
156
143
  render() {
157
144
  const {
158
145
  topbarMenuData,
@@ -191,7 +178,7 @@ export class NavigationBar extends React.Component {
191
178
  topbarIcons={topbarIcons}
192
179
  sidebarMenuData={[]}
193
180
  sidebarMenuItemsPosition={null}
194
- defaultSelectedProduct={this.productSelection()}
181
+ defaultSelectedProduct={intl.formatMessage(messages.selectedProductDefault)}
195
182
  skipStateForStorage
196
183
  selectOrganization={intl.formatMessage(messages.selectOrganization)}
197
184
  isLatestLeftNavigationEnabled={isLatestLeftNavigationEnabled}
@@ -212,7 +199,6 @@ export class NavigationBar extends React.Component {
212
199
  </CapWrapper>
213
200
  </div>
214
201
  </CapNavigation>
215
-
216
202
  );
217
203
  }
218
204
  }
@@ -20,11 +20,12 @@ export const getLoyaltyTopbarMenuDataValue = () => [
20
20
  link: 'loyalty/ui/',
21
21
  key: 'programs',
22
22
  },
23
- {
24
- label: <FormattedMessage {...globalMessages.promotions} />,
25
- link: 'loyalty/ui/promotions/list',
26
- key: 'promotions',
27
- },
23
+ //commented as promotions are not supported in loyalty v2 flow
24
+ // {
25
+ // label: <FormattedMessage {...globalMessages.promotions} />,
26
+ // link: 'loyalty/ui/promotions/',
27
+ // key: 'promotions',
28
+ // },
28
29
  {
29
30
  label: <FormattedMessage {...globalMessages.creatives} />,
30
31
  link: '/creatives/ui/v2/loyalty',
@@ -1105,8 +1105,9 @@ export class Creatives extends React.Component {
1105
1105
  onChange={(ev) => {
1106
1106
  const value = ev.currentTarget.value;
1107
1107
  const isEmptyTemplateName = value.trim() ? false : true;
1108
+
1109
+ const newFormData = {...formData, 'template-name': value, 'isTemplateNameEdited': true};
1108
1110
  this.setState({isTemplateNameEmpty: isEmptyTemplateName});
1109
- const newFormData = {...formData, 'template-name': value};
1110
1111
  onFormDataChange(newFormData);
1111
1112
  }}
1112
1113
  />)
@@ -220,6 +220,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
220
220
  }
221
221
  }
222
222
 
223
+
223
224
  checkBeeEditorAllowedForLibrary = () => {
224
225
  const { isFullMode = false, editor } = this.props || {};
225
226
  if ((editor === "BEE" && !isFullMode) || isFullMode) {
@@ -552,20 +553,18 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
552
553
  onFormDataChange = (updatedFormData, tabCount, currentTab) => {
553
554
  // this.transformFormData(formData);
554
555
  const formData = {...updatedFormData};
555
- const {defaultData = {}, isFullMode, showTemplateName, syncTemplateName} = this.props;
556
+ const {defaultData = {}, isFullMode, showTemplateName} = this.props;
556
557
  const templateName = formData['template-name'];
557
558
  const defaultTemplateName = _.get(defaultData, 'template-name', "");
558
559
 
559
- //sync back template name from from editing in create flow to wrapper when edited
560
- if (syncTemplateName) {
561
- syncTemplateName(_.isEmpty(templateName) && defaultTemplateName ? defaultTemplateName : templateName);
562
- }
563
560
 
564
- if (defaultData && _.isEmpty(templateName) && defaultTemplateName?.length >1 && isFullMode) {
561
+ if (defaultData && _.isEmpty(templateName) && isFullMode && !updatedFormData?.isTemplateNameEdited) {
565
562
  formData['template-name'] = defaultTemplateName;
566
563
  } else {
567
564
  formData['template-name'] = templateName;
568
565
  }
566
+
567
+
569
568
  this.setState({formData, tabCount, isSchemaChanged: false}, () => {
570
569
  if (this.props.isFullMode && showTemplateName) {
571
570
  showTemplateName({formData, onFormDataChange: this.onFormDataChange});
@@ -2778,7 +2777,6 @@ Email.propTypes = {
2778
2777
  getDefaultTags: PropTypes.string,
2779
2778
  currentOrgDetails: PropTypes.object,
2780
2779
  isLoadingMetaEntities: PropTypes.bool,
2781
- syncTemplateName: PropTypes.func,
2782
2780
  // creativesContainerActions: PropTypes.object,
2783
2781
  isFullMode: PropTypes.bool,
2784
2782
  setIsLoadingContent: PropTypes.func,
@@ -190,9 +190,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
190
190
  useEditor = (id) => {
191
191
  this.setState({ modeContent: { id } }, this.props.showNextStep);
192
192
  }
193
- onSyncTemplateName=(tempName) => {
194
- this.setState({templateName: tempName});
195
- }
193
+
196
194
  isShowEmailCreate = () => !_.isEmpty(this.state.selectedCreateMode) && (!_.isEmpty(this.props.EmailLayout) || this.props.SelectedEdmDefaultTemplate)
197
195
  render() {
198
196
  const {
@@ -278,7 +276,6 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
278
276
  getDefaultTags={type}
279
277
  isFullMode={isFullMode}
280
278
  defaultData={{ 'template-name': templateName }}
281
- syncTemplateName={this.onSyncTemplateName}
282
279
  cap={cap}
283
280
  showTemplateName={showTemplateName}
284
281
  onValidationFail={onValidationFail}
@@ -149,7 +149,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
149
149
  onFormDataChange = (formData, tabCount, currentTab, inputField) => {
150
150
  const newFormData = cloneDeep(formData);
151
151
  const {templateCta} = this.state;
152
- const {syncTemplateName, defaultData = {}, isFullMode, showTemplateName} = this.props;
152
+ const { defaultData = {}, isFullMode, showTemplateName} = this.props;
153
153
 
154
154
  if (!isEmpty(templateCta)) {
155
155
  newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-label`] = get(templateCta, 'name');
@@ -160,14 +160,10 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
160
160
  }
161
161
  }
162
162
 
163
- //sync back template name from from editing in create flow to wrapper when edited
163
+
164
164
  const templateName = formData['template-name'];
165
165
  const defaultTemplateName = get(defaultData, 'template-name', '');
166
- //sync back template name from from editing in create flow to wrapper when edited
167
166
 
168
- if (syncTemplateName) {
169
- syncTemplateName(isEmpty(templateName) && defaultTemplateName ? defaultTemplateName : templateName);
170
- }
171
167
 
172
168
  // copy content code
173
169
  // if (newFormData[0]['copy-iphone-content'] === "") {
@@ -191,11 +187,10 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
191
187
  // }
192
188
  // }
193
189
  //assign newFormData['template-name'] to default name only once in inital render, if edited use latest form data
194
- if (isFullMode && defaultData && isEmpty(templateName) && defaultTemplateName?.length>1) {
190
+ if (isFullMode && defaultData && isEmpty(templateName) && !formData?.isTemplateNameEdited) {
195
191
  newFormData['template-name'] = defaultTemplateName;
196
- } else {
197
- newFormData['template-name'] = templateName;
198
192
  }
193
+
199
194
  if (inputField && inputField.id === "add-sec-cta") {
200
195
  if (!newFormData[0]["add-sec-cta"]) {
201
196
  newFormData[0]["add-sec-cta-2"] = false;
@@ -1879,7 +1874,6 @@ Create.propTypes = {
1879
1874
  iosCtasData: PropTypes.array,
1880
1875
  injectedTags: PropTypes.object,
1881
1876
  defaultData: PropTypes.object,
1882
- syncTemplateName: PropTypes.func,
1883
1877
  showTemplateName: PropTypes.func,
1884
1878
  isGetFormData: PropTypes.bool,
1885
1879
  onValidationFail: PropTypes.func,
@@ -70,9 +70,7 @@ export class MobilepushWrapper extends React.Component { // eslint-disable-line
70
70
  onRemoveTemplateName();
71
71
  }
72
72
  }
73
- onSyncTemplateName=(tempName) => {
74
- this.setState({templateName: tempName});
75
- }
73
+
76
74
  render() {
77
75
  const {mobilePushCreateMode, step, getFormData, setIsLoadingContent, isGetFormData, query, isFullMode, showTemplateName, type, onValidationFail, onPreviewContentClicked, onTestContentClicked, templateData} = this.props;
78
76
  const {templateName} = this.state;
@@ -106,7 +104,6 @@ export class MobilepushWrapper extends React.Component { // eslint-disable-line
106
104
  getFormLibraryData={getFormData}
107
105
  setIsLoadingContent={setIsLoadingContent}
108
106
  defaultData={{"template-name": templateName}}
109
- syncTemplateName={this.onSyncTemplateName}
110
107
  location={{
111
108
  pathname: `/mobilepush/create/${mobilePushCreateMode}`,
112
109
  query,