@capillarytech/creatives-library 7.17.118-alpha.0 → 7.17.119

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.118-alpha.0",
4
+ "version": "7.17.119",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -177,7 +177,7 @@ function CapImageUpload(props) {
177
177
  const getImageSizeLabel = () => (
178
178
  <CapHeadingSpan type="label2">
179
179
  <FormattedMessage
180
- {...messages.imageSize}
180
+ {...messages.channelImageSize}
181
181
  values={{
182
182
  size: MAX_SUPPORTED_IMAGE_SIZE[channel],
183
183
  }}
@@ -190,7 +190,7 @@ function CapImageUpload(props) {
190
190
  return (<>
191
191
  <CapUploader.CapDragger
192
192
  customRequest={capUploaderCustomRequest}
193
- className="form-builder-dragger"
193
+ className="form-builder-dragger grey-background"
194
194
  showUploadList={!isImageError}
195
195
  >
196
196
  <CapHeading className="dragger-title" type="h7">
@@ -256,7 +256,7 @@ function CapImageUpload(props) {
256
256
  <div className="image-info-wrapper">
257
257
  {channel === WHATSAPP && (
258
258
  <>
259
- {getImageSizeLabel}
259
+ {getImageSizeLabel()}
260
260
  <CapHeadingSpan type="label2">
261
261
  <FormattedMessage {...messages.whatsappAspectRatio} />
262
262
  </CapHeadingSpan>
@@ -14,4 +14,7 @@ $classPrefix: cap-custom-image-upload;
14
14
  justify-content: space-between;
15
15
  margin-top: 8px;
16
16
  }
17
+ .grey-background div {
18
+ background: $CAP_G10;
19
+ }
17
20
  }
@@ -55,8 +55,8 @@ export default defineMessages({
55
55
  id: `${scope}.aspectRatio`,
56
56
  defaultMessage: 'Aspect ratio: 1:1',
57
57
  },
58
- imageSize: {
59
- id: `${scope}.imageSize`,
58
+ channelImageSize: {
59
+ id: `${scope}.channelImageSize`,
60
60
  defaultMessage: 'Size upto: {size}MB',
61
61
  },
62
62
  });
@@ -4,3 +4,4 @@ export const SUPPORTED_FILE_FORMATS = {
4
4
  VIBER: '3GP, MP4, MOV, M4V',
5
5
  DEFAULT: 'MP4',
6
6
  };
7
+ export const VIBER_MAX_DURATION = 600; // seconds
@@ -19,7 +19,7 @@ import {
19
19
  } from '@capillarytech/cap-ui-library';
20
20
  import messages from './messages';
21
21
  import {bytes2Size, getDecodedFileName} from '../../utils/common';
22
- import { SUPPORTED_FILE_FORMATS, WHATSAPP, DEFAULT } from './constants';
22
+ import { SUPPORTED_FILE_FORMATS, WHATSAPP, DEFAULT, VIBER_MAX_DURATION } from './constants';
23
23
  import './index.scss';
24
24
  import { VIBER } from '../../v2Containers/CreativesContainer/constants';
25
25
 
@@ -42,7 +42,7 @@ function CapVideoUpload(props) {
42
42
  } = props;
43
43
  const [isVideoError, updateVideoErrorMessage] = useState(false);
44
44
  const [isVideo, updateVideoStatus] = useState(false);
45
- const [videoDuration, updateVideoDuration] = useState('');
45
+ const [videoDuration, updateVideoDuration] = useState(null);
46
46
  const [isPlaying, updateIsPlaying] = useState(false);
47
47
  const [isSpinning, setSpinning] = useState(false);
48
48
 
@@ -100,6 +100,7 @@ function CapVideoUpload(props) {
100
100
  videoName: metaVideoName,
101
101
  videoId: metaVideoId,
102
102
  fileHandle: karixFileHandle,
103
+ videoDuration: null,
103
104
  },
104
105
  );
105
106
  }
@@ -200,6 +201,7 @@ function CapVideoUpload(props) {
200
201
  }
201
202
  const onReUpload = () => {
202
203
  updateVideoStatus(false);
204
+ updateVideoDuration(null);
203
205
  onVideoUploadUpdateAssestList(
204
206
  index,
205
207
  {
@@ -208,7 +210,7 @@ function CapVideoUpload(props) {
208
210
  videoHeight: "",
209
211
  videoWidth: "",
210
212
  videoSrc: "",
211
- videoDuration: "",
213
+ videoDuration: null,
212
214
  videoId: "",
213
215
  fileHandle: "",
214
216
  }
@@ -218,12 +220,13 @@ function CapVideoUpload(props) {
218
220
  const updateMetadataLoaded = () => {
219
221
  const { current: { duration, videoHeight: metaVideoHeight, videoWidth: metaVideoWidth } = {} } = videoEl;
220
222
  if (duration) {
221
- const value = moment('1900-01-01 00:00:00').add(duration, 'seconds').format("HH.mm.ss"); // to get the duration of video
222
- updateVideoDuration(value);
223
+ updateVideoDuration(duration);
223
224
  if (videoWidth === undefined && videoHeight === undefined) {
224
- onVideoUploadUpdateAssestList(
225
- index,
226
- {
225
+ if (
226
+ channel !== VIBER ||
227
+ (channel === VIBER && duration <= VIBER_MAX_DURATION)
228
+ ) {
229
+ onVideoUploadUpdateAssestList(index, {
227
230
  videoSrc,
228
231
  videoId,
229
232
  videoName,
@@ -231,13 +234,16 @@ function CapVideoUpload(props) {
231
234
  videoWidth: metaVideoWidth,
232
235
  previewUrl,
233
236
  fileHandle,
234
- videoDuration,
235
- }
236
- );
237
+ videoDuration: duration,
238
+ });
239
+ } else {
240
+ onReUpload();
241
+ updateVideoErrorMessage(formatMessage(messages.videoDurationError));
242
+ }
237
243
  }
238
244
  }
239
245
  };
240
-
246
+ const videoDurationValue = moment('1900-01-01 00:00:00').add(videoDuration, 'seconds').format("HH.mm.ss"); // to get the duration of video
241
247
  return (
242
248
  <Fragment key={videoSrc}>
243
249
  <div style={{ overflow: 'hidden' }}>
@@ -266,11 +272,11 @@ function CapVideoUpload(props) {
266
272
  </video>
267
273
  {showVideoNameAndDuration &&
268
274
  <div className="video-info">
269
- <CapHeading type="h6">
275
+ <CapHeading type="h4">
270
276
  {getDecodedFileName(videoName)}
271
277
  </CapHeading>
272
278
  <CapHeading type="h6">
273
- {videoDuration}
279
+ {videoDurationValue}
274
280
  </CapHeading>
275
281
  </div>
276
282
  }
@@ -314,7 +320,7 @@ function CapVideoUpload(props) {
314
320
  </CapHeading.CapHeadingSpan>
315
321
  {' '}
316
322
  <CapHeading.CapHeadingSpan type="h6" className="video-description file-format">
317
- <FormattedMessage {...messages.fileFormat} values={{ format: SUPPORTED_FILE_FORMATS[DEFAULT] }} />
323
+ <FormattedMessage {...messages.channelFileFormat} values={{ format: SUPPORTED_FILE_FORMATS[DEFAULT] }} />
318
324
  </CapHeading.CapHeadingSpan>
319
325
  <CapHeading.CapHeadingSpan type="h6" className="video-description video-details">
320
326
  <FormattedMessage {...messages.videoSizeDescription} values={{size: bytes2Size(videoSize)}} />
@@ -324,14 +330,14 @@ function CapVideoUpload(props) {
324
330
  <>
325
331
  {getVideoSizeDescription()}
326
332
  <CapHeading.CapHeadingSpan type="label2" className="whatsapp-format">
327
- <FormattedMessage {...messages.fileFormat} values={{ format: SUPPORTED_FILE_FORMATS[DEFAULT] }} />
333
+ <FormattedMessage {...messages.channelFileFormat} values={{ format: SUPPORTED_FILE_FORMATS[DEFAULT] }} />
328
334
  </CapHeading.CapHeadingSpan>
329
335
  </>}
330
336
  {channel === VIBER &&
331
337
  <>
332
338
  {getVideoSizeDescription()}
333
339
  <CapHeading.CapHeadingSpan type="label2" className="whatsapp-format">
334
- <FormattedMessage {...messages.fileFormat} values={{ format: SUPPORTED_FILE_FORMATS[channel] }} />
340
+ <FormattedMessage {...messages.channelFileFormat} values={{ format: SUPPORTED_FILE_FORMATS.VIBER }} />
335
341
  </CapHeading.CapHeadingSpan>
336
342
  <CapHeading.CapHeadingSpan type="label2" className="video-duration">
337
343
  <FormattedMessage {...messages.viberMaxDuration} />
@@ -55,12 +55,16 @@ export default defineMessages({
55
55
  id: `${scope}.imageReUpload`,
56
56
  defaultMessage: 'Re upload',
57
57
  },
58
- fileFormat: {
59
- id: `${scope}.fileFormat`,
58
+ channelFileFormat: {
59
+ id: `${scope}.channelFileFormat`,
60
60
  defaultMessage: 'Format: {format}',
61
61
  },
62
62
  viberMaxDuration: {
63
63
  id: `${scope}.viberMaxDuration`,
64
64
  defaultMessage: 'Max Duration: 600 seconds',
65
65
  },
66
+ videoDurationError: {
67
+ id: `${scope}.videoDurationError`,
68
+ defaultMessage: 'Video duration should not exceed 600 seconds',
69
+ },
66
70
  });
@@ -1,2 +1 @@
1
- export const AI_SUGGESTION_API_URL = `wss://${window.location.host}/arya/api/v1/ask-aira-service/content_gen/get_ai_suggestions`;
2
- export const CONTENT_RECOMMENDATION_BOT = "CONTENT_RECOMMENDATION_BOT";
1
+ export const OUTBOUND = 'OUTBOUND';
@@ -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, CONTENT_RECOMMENDATION_BOT } from './constants';
54
+ import { OUTBOUND } 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';
@@ -1152,7 +1152,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1152
1152
  let matchCustomerBarcode = regexCustomerBarcode.exec(content);
1153
1153
  // \S matches anything other than a space, a tab, a newline, or a carriage return.
1154
1154
  const validString= /\S/.test(contentForValidation);
1155
- if (isEmailUnsubscribeTagMandatory() && isEmail) {
1155
+ if (isEmailUnsubscribeTagMandatory() && isEmail && this.props?.moduleType === OUTBOUND) {
1156
1156
  const missingTagIndex = response?.missingTags?.indexOf("unsubscribe");
1157
1157
  if(missingTagIndex != -1) { //skip regex tags for mandatory tags also
1158
1158
  response?.missingTags?.splice(missingTagIndex, 1);
@@ -2375,13 +2375,17 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
2375
2375
  && hasAiSuggestionsEnabled
2376
2376
  && this.props.isFullMode
2377
2377
  && (
2378
- <CapAskAira
2378
+ <CapAskAira.ContentGenerationBot
2379
2379
  text={messageContent || ""}
2380
2380
  setText={(x) => {
2381
2381
  this.updateFormData(x, val);
2382
2382
  }}
2383
- botType={CONTENT_RECOMMENDATION_BOT}
2384
- websocketUrl={AI_SUGGESTION_API_URL}
2383
+ iconPlacement="float-br"
2384
+ rootStyle={{
2385
+ // 1rem is the margin-bottom of textarea
2386
+ bottom: 'calc(1rem + 0.2rem)',
2387
+ right: '0.2rem',
2388
+ }}
2385
2389
  />
2386
2390
  )}
2387
2391
  </CapColumn>
@@ -152,6 +152,7 @@ export function SlideBoxContent(props) {
152
152
  enableNewChannels,
153
153
  hideTestAndPreviewBtn,
154
154
  getCmsTemplatesInProgress = false,
155
+ moduleType,
155
156
  } = props;
156
157
  const type = (messageDetails.type || '').toLowerCase(); // type is context in get tags values : outbound | dvs | referral | loyalty | coupons
157
158
  const query = { type: !isFullMode && 'embedded', module: isFullMode ? 'default' : 'library', isEditFromCampaigns: (templateData || {}).isEditFromCampaigns};
@@ -597,6 +598,7 @@ export function SlideBoxContent(props) {
597
598
  onPreviewContentClicked={onPreviewContentClicked}
598
599
  onTestContentClicked={onTestContentClicked}
599
600
  getCmsTemplatesInProgress={getCmsTemplatesInProgress}
601
+ moduleType={moduleType}
600
602
  />
601
603
  )}
602
604
  {(isEditEmailWithId || isEmailEditWithContent) && (
@@ -623,6 +625,7 @@ export function SlideBoxContent(props) {
623
625
  selectedOfferDetails={selectedOfferDetails}
624
626
  onPreviewContentClicked={onPreviewContentClicked}
625
627
  onTestContentClicked={onTestContentClicked}
628
+ moduleType={moduleType}
626
629
  />
627
630
  )}
628
631
  {isEditMPush &&
@@ -911,5 +914,6 @@ SlideBoxContent.propTypes = {
911
914
  orgUnitId: PropTypes.any,
912
915
  smsRegister: PropTypes.any,
913
916
  getCmsTemplatesInProgress: PropTypes.bool,
917
+ moduleType: PropTypes.string,
914
918
  };
915
919
  export default SlideBoxContent;
@@ -1260,6 +1260,7 @@ export class Creatives extends React.Component {
1260
1260
  enableNewChannels={enableNewChannels}
1261
1261
  hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
1262
1262
  getCmsTemplatesInProgress={this.props.Templates?.getCmsTemplatesInProgress}
1263
+ moduleType={this.props.messageDetails?.type}
1263
1264
  />
1264
1265
  }
1265
1266
  footer={this.shouldShowFooter() &&
@@ -2653,7 +2653,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2653
2653
  const previewHeader = (<h3>{this.props.intl.formatMessage(messages.h3emailPreview)}</h3>);
2654
2654
  const imagePreviewHeader = (<h3>{this.props.intl.formatMessage(messages.h3imageSelection)}</h3>);
2655
2655
  const imagePreviewContent = this.getImagePreviewContent();
2656
- const { selectedOfferDetails, getDefaultTags, Email: { CmsSettings = {} } = {} } = this.props;
2656
+ const { selectedOfferDetails, getDefaultTags, Email: { CmsSettings = {} } = {}, moduleType = '' } = this.props;
2657
2657
  if (!this.props.currentOrgDetails || !this.props.currentOrgDetails.basic_details) {
2658
2658
  return (<div>Loading...</div>);
2659
2659
  }
@@ -2721,6 +2721,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2721
2721
  uuid={CmsSettings.uuid}
2722
2722
  type={CmsSettings.type}
2723
2723
  isEmailLoading={isLoading}
2724
+ moduleType={moduleType}
2724
2725
  /> : ''}
2725
2726
  </Col>
2726
2727
  </Row>
@@ -2776,6 +2777,7 @@ Email.propTypes = {
2776
2777
  selectedOfferDetails: PropTypes.array,
2777
2778
  onPreviewContentClicked: PropTypes.func,
2778
2779
  onTestContentClicked: PropTypes.func,
2780
+ moduleType: PropTypes.string,
2779
2781
  };
2780
2782
 
2781
2783
  const mapStateToProps = (state, props) => createStructuredSelector({
@@ -208,6 +208,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
208
208
  cmsTemplatesLoader,
209
209
  editor,
210
210
  currentOrgDetails,
211
+ moduleType,
211
212
  } = this.props;
212
213
  const {
213
214
  templateName,
@@ -278,6 +279,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
278
279
  onPreviewContentClicked={onPreviewContentClicked}
279
280
  onTestContentClicked={onTestContentClicked}
280
281
  editor={editor}
282
+ moduleType={moduleType}
281
283
  />}
282
284
  {!isShowEmailCreate && (
283
285
  <CmsTemplatesComponent
@@ -319,6 +321,7 @@ EmailWrapper.propTypes = {
319
321
  selectedOfferDetails: PropTypes.array,
320
322
  getCmsTemplatesInProgress: PropTypes.bool,
321
323
  currentOrgDetails: PropTypes.object,
324
+ moduleType: PropTypes.string,
322
325
  };
323
326
 
324
327
  const mapStateToProps = createStructuredSelector({
@@ -52041,7 +52041,7 @@ new message content.",
52041
52041
  >
52042
52042
  <FormattedMessage
52043
52043
  defaultMessage="Size upto: {size}MB"
52044
- id="creatives.componentsV2.CapImageUpload.imageSize"
52044
+ id="creatives.componentsV2.CapImageUpload.channelImageSize"
52045
52045
  values={
52046
52046
  Object {
52047
52047
  "size": 2,
@@ -67487,7 +67487,7 @@ new message content.",
67487
67487
  >
67488
67488
  <FormattedMessage
67489
67489
  defaultMessage="Size upto: {size}MB"
67490
- id="creatives.componentsV2.CapImageUpload.imageSize"
67490
+ id="creatives.componentsV2.CapImageUpload.channelImageSize"
67491
67491
  values={
67492
67492
  Object {
67493
67493
  "size": 2,
@@ -82827,7 +82827,7 @@ new message content.",
82827
82827
  >
82828
82828
  <FormattedMessage
82829
82829
  defaultMessage="Size upto: {size}MB"
82830
- id="creatives.componentsV2.CapImageUpload.imageSize"
82830
+ id="creatives.componentsV2.CapImageUpload.channelImageSize"
82831
82831
  values={
82832
82832
  Object {
82833
82833
  "size": 2,
@@ -98273,7 +98273,7 @@ new message content.",
98273
98273
  >
98274
98274
  <FormattedMessage
98275
98275
  defaultMessage="Size upto: {size}MB"
98276
- id="creatives.componentsV2.CapImageUpload.imageSize"
98276
+ id="creatives.componentsV2.CapImageUpload.channelImageSize"
98277
98277
  values={
98278
98278
  Object {
98279
98279
  "size": 2,
@@ -122770,7 +122770,7 @@ new message content.",
122770
122770
  >
122771
122771
  <FormattedMessage
122772
122772
  defaultMessage="Size upto: {size}MB"
122773
- id="creatives.componentsV2.CapImageUpload.imageSize"
122773
+ id="creatives.componentsV2.CapImageUpload.channelImageSize"
122774
122774
  values={
122775
122775
  Object {
122776
122776
  "size": 2,
@@ -370,7 +370,7 @@ export const Viber = (props) => {
370
370
  formClassName={"viber-video-upload"}
371
371
  channel={VIBER}
372
372
  errorMessage={formatMessage(messages.videoErrorMessage)}
373
- showVideoNameAndDuration={false}
373
+ showVideoNameAndDuration
374
374
  />
375
375
  );
376
376
 
@@ -647,12 +647,6 @@ export const Viber = (props) => {
647
647
  if (messageContent?.trim() === '' || errorMessageTextarea) {
648
648
  return true;
649
649
  }
650
- // // cannot send text + image only messages, Need to add button details or remove one of the components in order to proceed
651
- // const trimedButtonText = buttonText.trim();
652
- // const trimedButtonUrl = buttonURL.trim();
653
- // if (messageContent !== '' && (trimedButtonText === '' && trimedButtonUrl === '')) {
654
- // return true;
655
- // }
656
650
  //if template title is empty
657
651
  if (messageTitle?.trim() === '') {
658
652
  return true;