@capillarytech/creatives-library 7.17.61 → 7.17.63

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.61",
4
+ "version": "7.17.63",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -211,7 +211,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
211
211
  </CapTreeNode>
212
212
  );
213
213
  hidingDateTagsForJpLocale(hideDateTagsForJpLocale, val, list, tagValue);
214
- } else if (searchString === '' || !searchString || ((val.name || '').toLowerCase().indexOf(searchString.toLowerCase()) !== -1)) {
214
+ } else if (searchString === '' || !searchString || (String(val.name || '').toLowerCase().indexOf(searchString.toLowerCase()) !== -1)) {
215
215
  let childDisabled = true;
216
216
  if (key === CUSTOMER_BARCODE_TAG && !hasCustomerBarcodeFeatureEnabled()) {
217
217
  childDisabled = true;
@@ -11,6 +11,7 @@ import React from 'react';
11
11
 
12
12
  // import { FormattedMessage } from 'react-intl';
13
13
  import _ from 'lodash';
14
+ import CapSpin from '@capillarytech/cap-ui-library/CapSpin';
14
15
  // import messages from './messages';
15
16
  const loadScript = require('load-script');
16
17
  const defaultScriptUrl = `${window.location.origin}/arya/ui/library/ckeditor/ckeditor.js`;
@@ -137,6 +138,8 @@ class Ckeditor extends React.Component { // eslint-disable-line react/prefer-sta
137
138
  content: "",
138
139
  editorInstance: undefined,
139
140
  setInitData: false,
141
+ isLoading: true,
142
+ scriptLoaded: false,
140
143
  };
141
144
 
142
145
  this.delayTimer = 0;
@@ -182,10 +185,14 @@ class Ckeditor extends React.Component { // eslint-disable-line react/prefer-sta
182
185
  }
183
186
  }
184
187
  }
188
+ onLoad = () => {
189
+ this.setState({ scriptLoaded: true }, () => {
190
+ this.initializeEditor();
191
+ });
192
+ };
185
193
 
186
- onLoad() {
194
+ initializeEditor = () => {
187
195
  if (this.unmounting) return;
188
-
189
196
 
190
197
  if (!window.CKEDITOR) {
191
198
  console.error("CKEditor not found");
@@ -243,6 +250,7 @@ class Ckeditor extends React.Component { // eslint-disable-line react/prefer-sta
243
250
  this.editorInstance.on(index, event);
244
251
  });
245
252
  }
253
+ this.setState({ isLoading: false });
246
254
  }
247
255
 
248
256
  onFocusOut = () => {
@@ -271,11 +279,12 @@ class Ckeditor extends React.Component { // eslint-disable-line react/prefer-sta
271
279
  };
272
280
 
273
281
  render() {
274
-
275
282
  return (
276
- <div id={this.props.id} style={{borderRight: "1px solid #000 !important"}}>
277
- <div className={this.props.activeClass} ref={(node) => (this.node = node)}/>
278
- </div>
283
+ <CapSpin spinning={this.state.isLoading}>
284
+ <div id={this.props.id} style={{borderRight: "1px solid #000 !important"}}>
285
+ <div className={this.props.activeClass} ref={(node) => (this.node = node)}/>
286
+ </div>
287
+ </CapSpin>
279
288
  );
280
289
  }
281
290
  }
@@ -2362,7 +2362,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2362
2362
  history: [],
2363
2363
  };
2364
2364
  if (this.state.isEdit) {
2365
- obj._id = this.props.Email.templateDetails._id;
2365
+ obj._id = this.props.Email.templateDetails?._id || '';
2366
2366
  }
2367
2367
  obj.type = 'EMAIL';
2368
2368
  const baseLanguage = this.props.currentOrgDetails.basic_details.base_language;
@@ -874,7 +874,6 @@ export const Whatsapp = (props) => {
874
874
 
875
875
  const templateMessageErrorHandler = (value) => {
876
876
  let errorMessage = false;
877
- const percentSignRegex = /%/;
878
877
  if (value === '') {
879
878
  errorMessage = formatMessage(messages.emptyTemplateMessageErrorMessage);
880
879
  } else if (
@@ -882,9 +881,6 @@ export const Whatsapp = (props) => {
882
881
  TEMPLATE_MESSAGE_MAX_LENGTH
883
882
  ) {
884
883
  errorMessage = formatMessage(messages.templateMessageLengthError);
885
- } else if ( host === HOST_GUPSHUP && percentSignRegex.test(value)
886
- ) {
887
- errorMessage = formatMessage(messages.noPercentSign);
888
884
  } else {
889
885
  const validVarArr = value.match(validVarRegex) || [];
890
886
  const validVarSet = [...new Set(validVarArr)];
@@ -17,6 +17,7 @@ export const DEFAULT = 'default';
17
17
  export const LIBRARY = 'library';
18
18
  export const FULL = 'full';
19
19
  export const ALL = 'all';
20
+ export const OUTBOUND = 'outbound';
20
21
 
21
22
  const prefix = 'app/v2Containers/Zalo';
22
23
  export const ZALO_TEMPLATE_INFO_REQUEST = `${prefix}/ZALO_TEMPLATE_INFO_REQUEST`;
@@ -35,6 +35,7 @@ import {
35
35
  TAG,
36
36
  FULL,
37
37
  ALL,
38
+ OUTBOUND,
38
39
  LIBRARY,
39
40
  ERROR_ALERT,
40
41
  WARNING_ALERT,
@@ -83,6 +84,7 @@ export const Zalo = (props) => {
83
84
  const {
84
85
  _id = '',
85
86
  accountId = '',
87
+ zaloAccountId = '',
86
88
  accountName = '',
87
89
  templateConfigs: { id = '', varMapped = {} } = {},
88
90
  token: zaloToken = '',
@@ -110,7 +112,8 @@ export const Zalo = (props) => {
110
112
  configs: { token: accessToken = '' } = {},
111
113
  name = '',
112
114
  } = selectedZaloAccount;
113
- setOaId(sourceAccountIdentifier || accountId);
115
+ const oaId = getDefaultTags === OUTBOUND ? zaloAccountId : accountId;
116
+ setOaId(sourceAccountIdentifier || oaId);
114
117
  setToken(accessToken || zaloToken);
115
118
  setUsername(name || accountName);
116
119
  }
@@ -356,6 +359,9 @@ export const Zalo = (props) => {
356
359
  const payload = {
357
360
  channel: ZALO,
358
361
  accountId: oa_id,
362
+ ...(getDefaultTags === OUTBOUND && {
363
+ zaloAccountId: oa_id,
364
+ }),
359
365
  accountName: username,
360
366
  templateConfigs: {
361
367
  id: templateId?.toString(),