@capillarytech/creatives-library 7.10.41 → 7.10.42

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.10.41",
4
+ "version": "7.10.42",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -195,8 +195,8 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
195
195
  };
196
196
  const whatsappSectionStyle = {
197
197
  "padding": '3.5px 0 0',
198
- 'border-radius': '6px',
199
- 'background-color': CAP_G15,
198
+ 'borderRadius': '6px',
199
+ 'backgroundColor': CAP_G15,
200
200
  'width': '88%',
201
201
  'left': '10%',
202
202
  };
@@ -134,8 +134,10 @@ export const Whatsapp = (props) => {
134
134
  }
135
135
  //cleanup code
136
136
  return () => {
137
- actions.resetEditTemplate();
138
- varMap = {};
137
+ if (isEditFlow) {
138
+ actions.resetEditTemplate();
139
+ varMap = {};
140
+ }
139
141
  };
140
142
  }, [paramObj.id]);
141
143
 
@@ -214,28 +216,32 @@ export const Whatsapp = (props) => {
214
216
  // tag Code start from here
215
217
  useEffect(() => {
216
218
  //fetching tags
217
- const { type, module } = location.query || {};
218
- const isEmbedded = type === EMBEDDED;
219
- const query = {
220
- layout: 'SMS',
221
- type: TAG,
222
- context: isEmbedded ? module : DEFAULT,
223
- embedded: isEmbedded ? type : FULL,
224
- };
225
- if (getDefaultTags) {
226
- query.context = getDefaultTags;
219
+ if (isEditFlow) {
220
+ const { type, module } = location.query || {};
221
+ const isEmbedded = type === EMBEDDED;
222
+ const query = {
223
+ layout: 'SMS',
224
+ type: TAG,
225
+ context: isEmbedded ? module : DEFAULT,
226
+ embedded: isEmbedded ? type : FULL,
227
+ };
228
+ if (getDefaultTags) {
229
+ query.context = getDefaultTags;
230
+ }
231
+ globalActions.fetchSchemaForEntity(query);
227
232
  }
228
- globalActions.fetchSchemaForEntity(query);
229
233
  }, []);
230
234
 
231
235
  useEffect(() => {
232
- let tag =
233
- metaEntities && metaEntities.tags ? metaEntities.tags.standard : [];
234
- const { type, module } = location.query || {};
235
- if (type === EMBEDDED && module === LIBRARY && !getDefaultTags) {
236
- tag = supportedTags;
236
+ if (isEditFlow) {
237
+ let tag =
238
+ metaEntities && metaEntities.tags ? metaEntities.tags.standard : [];
239
+ const { type, module } = location.query || {};
240
+ if (type === EMBEDDED && module === LIBRARY && !getDefaultTags) {
241
+ tag = supportedTags;
242
+ }
243
+ updateTags(tag);
237
244
  }
238
- updateTags(tag);
239
245
  }, [metaEntities]);
240
246
 
241
247
  const handleOnTagsContextChange = (data) => {
@@ -351,10 +357,13 @@ export const Whatsapp = (props) => {
351
357
  </>
352
358
  );
353
359
 
360
+ //used by create and edit
354
361
  const renderMessageLength = () => (
355
362
  <CapHeading type="h6" className="whatsapp-render-message-length">
356
363
  {formatMessage(messages.templateMessageLength, {
357
- currentLength: UNSUBSCRIBE_TEXT_LENGTH + templateMessage?.length,
364
+ currentLength: isEditFlow
365
+ ? updatedSmsEditor?.join('')?.length + UNSUBSCRIBE_TEXT_LENGTH
366
+ : templateMessage?.length + UNSUBSCRIBE_TEXT_LENGTH,
358
367
  maxLength: TEMPLATE_MESSAGE_MAX_LENGTH,
359
368
  })}
360
369
  </CapHeading>
@@ -733,6 +742,7 @@ export const Whatsapp = (props) => {
733
742
  />
734
743
  </CapRow>
735
744
  <CapTooltip
745
+ placement="bottom"
736
746
  title={
737
747
  templateStatus === WHATSAPP_STATUSES.approved
738
748
  ? ''
@@ -760,10 +770,18 @@ export const Whatsapp = (props) => {
760
770
  );
761
771
  //edit methods end
762
772
 
773
+ //used by create and edit
763
774
  const getPreviewSection = () => {
764
- const templateMsg = `${
765
- isEditFlow ? updatedSmsEditor.join('') : templateMessage
766
- }\n${formatMessage(messages.templateMessageUnsubscribeText)}`;
775
+ const templateMsg = (
776
+ <>
777
+ <CapLabel type="label5">
778
+ {isEditFlow ? updatedSmsEditor.join('') : templateMessage}
779
+ </CapLabel>
780
+ <CapLabel type="label11">
781
+ {formatMessage(messages.templateMessageUnsubscribeText)}
782
+ </CapLabel>
783
+ </>
784
+ );
767
785
  return (
768
786
  <TemplatePreview
769
787
  channel={WHATSAPP}