@capillarytech/creatives-library 6.8.5 → 6.8.7

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/app.js CHANGED
@@ -76,7 +76,6 @@ Bugsnag.start({
76
76
  // eslint-disable-next-line no-undef
77
77
  apiKey: BUGSNAG_API_KEY,
78
78
  releaseStage: window.location.hostname,
79
- enabledReleaseStages: ['production', 'staging'],
80
79
  plugins: [new BugsnagPluginReact()],
81
80
  onError: bugSnagErrorCallback,
82
81
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "6.8.5",
4
+ "version": "6.8.7",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -1,3 +1,4 @@
1
1
  export const LINE_IMG_HEIGHT = 400;
2
2
  export const LINE_IMG_WIDTH = 300;
3
- export const LINE_IMG_SIZE = 30000000;
3
+ export const LINE_IMG_SIZE = 10000000;
4
+ export const ALLOWED_EXTENSIONS_REGEX = (/\.(jpe?g|png)$/i);
@@ -6,12 +6,11 @@ import CapUploader from '@capillarytech/cap-ui-library/CapUploader';
6
6
  import CapHeading from '@capillarytech/cap-ui-library/CapHeading';
7
7
  import CapButton from '@capillarytech/cap-ui-library/CapButton';
8
8
  import CapDrawer from '@capillarytech/cap-ui-library/CapDrawer';
9
- import CapLabel from '@capillarytech/cap-ui-library/CapLabel';
10
9
  import CapImage from '@capillarytech/cap-ui-library/CapImage';
11
10
  import CapHeader from '@capillarytech/cap-ui-library/CapHeader';
12
11
  import LabelHOC from '@capillarytech/cap-ui-library/assets/HOCs/ComponentWithLabelHOC';
13
12
  import LineDrawer from '../Drawer';
14
- import { CAP_SPACE_12, CAP_SPACE_08, FONT_COLOR_05, FONT_COLOR_04 } from '@capillarytech/cap-ui-library/styled/variables';
13
+ import { CAP_SPACE_12, CAP_SPACE_08, FONT_COLOR_05 } from '@capillarytech/cap-ui-library/styled/variables';
15
14
  import Gallery from '../../../Assets/Gallery';
16
15
  import style from './style';
17
16
  import { CAP_G06, CAP_G09 } from '@capillarytech/cap-ui-library/styled/variables';
@@ -22,6 +21,7 @@ import {
22
21
  LINE_IMG_HEIGHT,
23
22
  LINE_IMG_WIDTH,
24
23
  LINE_IMG_SIZE,
24
+ ALLOWED_EXTENSIONS_REGEX,
25
25
  } from './constants';
26
26
 
27
27
  export const LineImage = ({
@@ -168,11 +168,8 @@ export const LineImage = ({
168
168
  const _URL = window.URL || window.webkitURL;
169
169
  let incorrectFile = false;
170
170
  const file = files[0];
171
- if (supportedExtensions) {
172
- const allowedExtensions = /(\.bmp|\.jpeg|\.png|\.gif|\.jpg)$/i;
173
- if (!allowedExtensions.exec(file.name)) {
174
- incorrectFile = true;
175
- }
171
+ if (!ALLOWED_EXTENSIONS_REGEX.test(file.name)) {
172
+ incorrectFile = true;
176
173
  }
177
174
  const img = new Image();
178
175
  img.src = _URL.createObjectURL(file);
@@ -402,18 +399,23 @@ export const LineImage = ({
402
399
  const image = get(imageTemplate, 'metaInfo.secure_file_path');
403
400
  const imagePreview = get(imageTemplate, 'metaInfo.secure_file_path_preview');
404
401
  updateDrawerRequirement(false);
405
- updateImageStatus(true);
406
- updateImageSrc(image);
407
- updateImagePreview(imagePreview);
408
- updateMessageState({
409
- isError: !image || !(isFullMode ? messageTitle : true) || (isImageError && errorMessageTitle),
410
- originalContentUrl: image,
411
- previewImageUrl: imagePreview,
412
- messageTitle,
413
- index,
414
- type: 'image',
415
- messageType: 'originalContentUrl',
416
- });
402
+ if (!ALLOWED_EXTENSIONS_REGEX.test(image)) {
403
+ updateImageErrorMessage(formatMessage(messages.lineImageIncorrectSize));
404
+ } else {
405
+ updateImageErrorMessage('');
406
+ updateImageStatus(true);
407
+ updateImageSrc(image);
408
+ updateImagePreview(imagePreview);
409
+ updateMessageState({
410
+ isError: !image || !(isFullMode ? messageTitle : true) || (isImageError && errorMessageTitle),
411
+ originalContentUrl: image,
412
+ previewImageUrl: imagePreview,
413
+ messageTitle,
414
+ index,
415
+ type: 'image',
416
+ messageType: 'originalContentUrl',
417
+ });
418
+ }
417
419
  }
418
420
 
419
421
  const getGalleryDrawerContent = () => {
@@ -37,7 +37,7 @@ export default defineMessages({
37
37
  },
38
38
  "imageDimenstionDescription": {
39
39
  id: `${scope}.imageDimenstionDescription`,
40
- defaultMessage: 'Dimensions: 300px x 400px Size: 30mb',
40
+ defaultMessage: 'Dimensions: 300px x 400px Size: 10mb',
41
41
  },
42
42
  "imageReUpload": {
43
43
  id: `${scope}.imageReUpload`,
@@ -166,6 +166,9 @@ export const LineImageMap = ({
166
166
  const validWidth = width === LINE_ASSET_WIDTH;
167
167
  const isCustom = assetType === CUSTOM_ASSET_TYPE;
168
168
  const validHeight = isCustom ? ( LINE_CUSTOM_ASSET_HEIGHT_MIN <= height && height <= LINE_CUSTOM_ASSET_HEIGHT_MAX) : height === LINE_ASSET_HEIGHT;
169
+ if (isCustom) {
170
+ data.fileParams.assetType = CUSTOM_ASSET_TYPE;
171
+ }
169
172
  if (incorrectFile || !validWidth || !validHeight) {
170
173
  updateImageErrorMessage(formatMessage(messages.lineImageMapIncorrectSize));
171
174
  } else {
@@ -177,7 +180,7 @@ export const LineImageMap = ({
177
180
  });
178
181
  actions.uploadAsset(
179
182
  data.file,
180
- isCustom ? `${data.type}?assetType=${CUSTOM_ASSET_TYPE}` : data.type,
183
+ data.type,
181
184
  data.fileParams,
182
185
  );
183
186
  }
@@ -432,7 +435,7 @@ export const LineImageMap = ({
432
435
  }] = [{}],
433
436
  } = {},
434
437
  } = template.versions.base;
435
- templateData.url = baseUrl;
438
+ templateData.url = `${baseUrl}/1040`;
436
439
  templateData.title = template.name;
437
440
  templateData.key = template.name;
438
441
  templateData.hoverOption = (
@@ -1,4 +1,4 @@
1
- import React, { useState, useEffect } from 'react';
1
+ import React, { useState, useEffect, Fragment } from 'react';
2
2
  import { injectIntl, FormattedMessage } from 'react-intl';
3
3
  import CapTab from '@capillarytech/cap-ui-library/CapTab';
4
4
  import CapButton from '@capillarytech/cap-ui-library/CapButton';
@@ -126,9 +126,9 @@ export const LineWrapper = ({
126
126
  <CapTab
127
127
  defaultActiveKey={TEXT}
128
128
  activeKey={activeKey}
129
- tabBarExtraContent={operations}
129
+ tabBarExtraContent={rest.isFullMode ? <Fragment /> : operations}
130
130
  onChange={onTabChange}
131
- panes={getTabPanes({ ...rest, index, activeKey, formatMessage: intl.formatMessage })}
131
+ panes={getTabPanes({ ...rest, index, activeKey, formatMessage: intl.formatMessage, isFullMode: rest.isFullMode })}
132
132
  />
133
133
  <StyledCapModal
134
134
  title={intl.formatMessage(messages.changeModalTitle)}
@@ -41,6 +41,6 @@ export default defineMessages({
41
41
  },
42
42
  "imagemapLabel": {
43
43
  id: `${scope}.imagemapLabel`,
44
- defaultMessage: 'Image Map',
44
+ defaultMessage: 'Rich message',
45
45
  },
46
46
  });
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import CapIcon from '@capillarytech/cap-ui-library/CapIcon';
3
3
  import CapTooltip from '@capillarytech/cap-ui-library/CapTooltip';
4
- import { CAP_WHITE } from '@capillarytech/cap-ui-library/styled/variables';
4
+ import { CAP_WHITE, FONT_SIZE_VL } from '@capillarytech/cap-ui-library/styled/variables';
5
5
 
6
6
  import { TEXT, IMAGE, IMAGE_MAP, STICKER } from '../constants';
7
7
  import LineText from '../Text';
@@ -37,7 +37,8 @@ export const itemIcons = {
37
37
 
38
38
  export const getTabPanes = (props) => {
39
39
  const tableKeys = [TEXT, IMAGE, STICKER, IMAGE_MAP];
40
- return tableKeys.map((item) => {
40
+ const tableKeysCreatives = [TEXT, IMAGE, IMAGE_MAP];
41
+ return (props.isFullMode ? tableKeysCreatives : tableKeys).map((item) => {
41
42
  const isSelected = props.activeKey === item;
42
43
  return {
43
44
  key: item,
@@ -48,6 +49,7 @@ export const getTabPanes = (props) => {
48
49
  <CapIcon
49
50
  type={itemIcons[item]}
50
51
  size="s"
52
+ style={{ fontSize: FONT_SIZE_VL }}
51
53
  theme={isSelected ? 'filled' : ''}
52
54
  svgProps={{
53
55
  fill: isSelected ? '#000' : CAP_WHITE,
@@ -544,15 +544,21 @@ export const LineContainer = ({
544
544
  description={formatMessage(messages.lineCreativeDescription)}
545
545
  />
546
546
  {getLineWrappers()}
547
- <CapButton
548
- onClick={addLineWrappers}
549
- disabled={lineWrapperContents.length === (isFullMode ? MAX_LINE_WRAPPER_LIMIT_FULL_MODE : MAX_LINE_WRAPPER_LIMIT)}
550
- type="flat"
551
- isAddBtn
552
- className="add-msg"
553
- >
554
- <FormattedMessage {...messages.addMessageButtonLabel} />
555
- </CapButton>
547
+ {
548
+ !isFullMode
549
+ ? (
550
+ <CapButton
551
+ onClick={addLineWrappers}
552
+ disabled={lineWrapperContents.length === (isFullMode ? MAX_LINE_WRAPPER_LIMIT_FULL_MODE : MAX_LINE_WRAPPER_LIMIT)}
553
+ type="flat"
554
+ isAddBtn
555
+ className="add-msg"
556
+ >
557
+ <FormattedMessage {...messages.addMessageButtonLabel} />
558
+ </CapButton>
559
+ )
560
+ : null
561
+ }
556
562
  </CapColumn>
557
563
  <CapColumn span={6}>
558
564
  <CapRow>
@@ -81,7 +81,6 @@ const LINE_FILTERS = {
81
81
  ALL: 'all',
82
82
  TEXT: 'text',
83
83
  IMAGE_VIDEO: 'image',
84
- STICKER: 'sticker',
85
84
  IMAGE_MAP: 'imagemap'
86
85
  };
87
86
 
@@ -1796,9 +1795,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1796
1795
  <CapRadio.Button value={IMAGE_VIDEO}><CapLabel type="label2">
1797
1796
  <FormattedMessage {...messages.imageTemplate} />
1798
1797
  </CapLabel></CapRadio.Button>
1799
- <CapRadio.Button value={STICKER}><CapLabel type="label2">
1800
- <FormattedMessage {...messages.stickerTemplate} />
1801
- </CapLabel></CapRadio.Button>
1802
1798
  <CapRadio.Button value={IMAGE_MAP}><CapLabel type="label2">
1803
1799
  <FormattedMessage {...messages.imageMapTemplate} />
1804
1800
  </CapLabel></CapRadio.Button>
@@ -238,13 +238,9 @@ export default defineMessages({
238
238
  id: `${scope}.imageTemplate`,
239
239
  defaultMessage: `Image`,
240
240
  },
241
- "stickerTemplate": {
242
- id: `${scope}.stickerTemplate`,
243
- defaultMessage: `Sticker`,
244
- },
245
241
  "imageMapTemplate": {
246
242
  id: `${scope}.imageMapTemplate`,
247
- defaultMessage: `Image map`,
243
+ defaultMessage: `Rich message`,
248
244
  },
249
245
  "selectDefaultButton": {
250
246
  id: `${scope}.selectDefaultButton`,