@capillarytech/creatives-library 7.7.23 → 7.7.24

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.
@@ -780,7 +780,16 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
780
780
  type: "radioGroup",
781
781
  metaType: "text",
782
782
  datatype: "string",
783
- options: [formatMessage(messages.redirectOptionURL), formatMessage(messages.redirectOptionMiniProgram)],
783
+ options: [
784
+ {
785
+ value: URL,
786
+ label: formatMessage(messages.redirectOptionURL)
787
+ },
788
+ {
789
+ value: MINI_PROGRAM,
790
+ label: formatMessage(messages.redirectOptionMiniProgram)
791
+ }
792
+ ],
784
793
  errorMessage: formatMessage(messages.redirectionOptionError),
785
794
  required: true,
786
795
  fluid: true,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.7.23",
4
+ "version": "7.7.24",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -85,6 +85,12 @@ function CapImageUpload(props) {
85
85
  };
86
86
  submitAction({file, type: 'image', fileParams}, incorrectFile);
87
87
  };
88
+ img.onerror = () => {
89
+ const fileParams = {
90
+ error: true,
91
+ };
92
+ submitAction({fileParams}, incorrectFile);
93
+ }
88
94
  if (e) {
89
95
  const event = e;
90
96
  event.target.value = null;
@@ -93,13 +99,12 @@ function CapImageUpload(props) {
93
99
 
94
100
  const submitAction = useCallback((data, incorrectFile) => {
95
101
  const {
96
- file: {size},
97
- fileParams: {
98
- height,
99
- width,
100
- },
101
- } = data;
102
- if (incorrectFile || size > imgSize || height > imgHeight || width > imgWidth) {
102
+ file,
103
+ fileParams
104
+ } = data || {};
105
+ const { size } = file || {};
106
+ const { height, width, error } = fileParams || {};
107
+ if (incorrectFile || size > imgSize || height > imgHeight || width > imgWidth || error) {
103
108
  updateImageErrorMessage(formatMessage(messages.imageIncorrectSize));
104
109
  } else {
105
110
  updateImageErrorMessage('');
@@ -166,6 +171,7 @@ function CapImageUpload(props) {
166
171
  <CapUploader.CapDragger
167
172
  customRequest={capUploaderCustomRequest}
168
173
  className="form-builder-dragger"
174
+ showUploadList={!isImageError}
169
175
  >
170
176
  <CapHeading className="dragger-title" type="h7">
171
177
  <FormattedMessage {...messages.dragAndDrop} />
@@ -198,7 +204,7 @@ function CapImageUpload(props) {
198
204
  <FormattedMessage {...messages.imageReUpload} />
199
205
  </CapButton>
200
206
  );
201
- }, []);
207
+ }, [isImageError]);
202
208
 
203
209
  return (
204
210
  <div style={style} className="cap-custom-image-upload">
@@ -2854,7 +2854,16 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
2854
2854
  name={val.name ? val.name : `${val.id}-name`}
2855
2855
  disabled={val.disabled}
2856
2856
  >
2857
- {val.options.map((option, index) => <CapRadio value={option} inductiveText={val.inductiveText && val.inductiveText[index]}>{option}</CapRadio>) }
2857
+ {val.options.map((option, index) => {
2858
+ const isMappedTemplateWechat = val.id === "template-redirect-options-radio";
2859
+ return (
2860
+ <CapRadio
2861
+ value={ isMappedTemplateWechat ? option.value : option }
2862
+ inductiveText={val.inductiveText && val.inductiveText[index]}>{ isMappedTemplateWechat ? option.label : option }
2863
+ </CapRadio>
2864
+ )
2865
+ }
2866
+ )}
2858
2867
 
2859
2868
  </CapRadioGroup>
2860
2869
  {/*{ifError ?*/}
@@ -91,7 +91,7 @@ class Creatives extends React.Component {
91
91
  this.setState({ slidBoxContent: 'preview', templateData });
92
92
  };
93
93
  onEditTemplate = () => {
94
- this.setState({ slidBoxContent: 'editTemplate', showSlideBox: true });
94
+ this.setState({ slidBoxContent: 'editTemplate', showSlideBox: true, templateNameExists: true });
95
95
  };
96
96
  onCreateNew = (fbAdManager) => {
97
97
  const data = { slidBoxContent: 'createTemplate', showSlideBox: true };
@@ -666,7 +666,16 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
666
666
  type: "radioGroup",
667
667
  metaType: "text",
668
668
  datatype: "string",
669
- options: [intl.formatMessage(messages.redirectOptionURL), intl.formatMessage(messages.redirectOptionMiniProgram)],
669
+ options: [
670
+ {
671
+ value: URL,
672
+ label: intl.formatMessage(messages.redirectOptionURL)
673
+ },
674
+ {
675
+ value: MINI_PROGRAM,
676
+ label: intl.formatMessage(messages.redirectOptionMiniProgram)
677
+ }
678
+ ],
670
679
  errorMessage: intl.formatMessage(messages.redirectionOptionError),
671
680
  required: true,
672
681
  fluid: true,