@capillarytech/creatives-library 8.0.312-alpha.0 → 8.0.312-alpha.1

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": "8.0.312-alpha.0",
4
+ "version": "8.0.312-alpha.1",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable no-restricted-syntax */
2
2
  /* eslint-disable no-undef */
3
- import React, { useState, useEffect, useRef } from 'react';
3
+ import React, { useState, useEffect } from 'react';
4
4
  import { createStructuredSelector } from 'reselect';
5
5
  import { bindActionCreators } from 'redux';
6
6
  import { FormattedMessage } from 'react-intl';
@@ -100,18 +100,18 @@ export const SmsTraiEdit = (props) => {
100
100
  /** After user closes the validation panel, keep it hidden until Save is clicked again (even if ErrorInfoNote remounts). */
101
101
  const [liquidErrorPanelDismissed, setLiquidErrorPanelDismissed] = useState(false);
102
102
  const [showTestAndPreviewSlidebox, setShowTestAndPreviewSlidebox] = useState(false);
103
- const routeTemplateId = (params && params.id) || '';
104
- const traitSource = isFullMode ? templateDetails : templateData;
105
- const smsEditorSource = get(traitSource, 'versions.base.sms-editor', '') || '';
106
- const baseTemplateId = get(traitSource, 'versions.base.template_id', '') || '';
107
- /** Avoid reparsing props into tempMsgArray when only object identity changes (fixes cleared text snapping back). */
108
- const lastHydratedSignatureRef = useRef(null);
109
103
  const SMSTraiFooter = styled.div`
110
104
  background-color: ${CAP_WHITE};
111
105
  padding: ${CAP_SPACE_32} ${CAP_SPACE_24};
112
106
  position: fixed;
113
107
  bottom: 2rem;
114
108
  margin-left: -2rem;
109
+ /* Prevent global creatives tabpane min-height from stretching footer validation tabs */
110
+ .error-info-note__tabs {
111
+ .ant-tabs-tabpane {
112
+ min-height: auto !important;
113
+ }
114
+ }
115
115
  .ant-btn {
116
116
  margin-right: ${CAP_SPACE_16};
117
117
  }
@@ -153,43 +153,29 @@ export const SmsTraiEdit = (props) => {
153
153
  //computing placeholder array for mapping values and rendering dynamic form
154
154
  useEffect(() => {
155
155
  traiData = isFullMode ? templateDetails : templateData;
156
- if (!traiData || isEmpty(traiData)) {
157
- return;
158
- }
159
- const hydrateSignature = `${String(isFullMode)}|${routeTemplateId}|${baseTemplateId}|${smsEditorSource}`;
160
- if (lastHydratedSignatureRef.current === hydrateSignature) {
161
- return;
162
- }
163
- lastHydratedSignatureRef.current = hydrateSignature;
164
-
165
- let msg = smsEditorSource;
166
- const templateMessageArray = [];
167
- //converting sms-editor string to an array split at '{#var#}'
168
- //split and push string before '{#var#}[0 to index]', push '{#var#}',
169
- //split and repeat for remaining string[index+7 to length]
170
- while (msg.length !== 0) {
171
- const index = msg.search(SMS_TRAI_VAR);
172
- if (index !== -1) {
173
- templateMessageArray.push(msg.substring(0, index));
174
- templateMessageArray.push(SMS_TRAI_VAR);
175
- msg = msg.substring(index + 7, msg.length);
176
- } else {
177
- templateMessageArray.push(msg);
178
- break;
156
+ if (traiData && !isEmpty(traiData)) {
157
+ let msg = get(traiData, `versions.base.sms-editor`, '');
158
+ const templateMessageArray = [];
159
+ //converting sms-editor string to an array split at '{#var#}'
160
+ //split and push string before '{#var#}[0 to index]', push '{#var#}',
161
+ //split and repeat for remaining string[index+7 to length]
162
+ while (msg.length !== 0) {
163
+ const index = msg.search(SMS_TRAI_VAR);
164
+ if (index !== -1) {
165
+ templateMessageArray.push(msg.substring(0, index));
166
+ templateMessageArray.push(SMS_TRAI_VAR);
167
+ msg = msg.substring(index + 7, msg.length);
168
+ } else {
169
+ templateMessageArray.push(msg);
170
+ break;
171
+ }
179
172
  }
173
+ const filteredTemplateMessageArray = templateMessageArray.filter((i) => i === 0 || i);
174
+ updateTempMsgArray(filteredTemplateMessageArray);
175
+ //stop spinner
176
+ updateLoading(false);
180
177
  }
181
- const filteredTemplateMessageArray = templateMessageArray.filter((i) => i === 0 || i);
182
- updateTempMsgArray(filteredTemplateMessageArray);
183
- //stop spinner
184
- updateLoading(false);
185
- }, [
186
- isFullMode,
187
- routeTemplateId,
188
- baseTemplateId,
189
- smsEditorSource,
190
- templateDetails,
191
- templateData,
192
- ]);
178
+ }, [templateDetails || templateData]);
193
179
 
194
180
  //compute/get varMapped and updated-sms-editor
195
181
  useEffect(() => {