@capillarytech/creatives-library 9.0.15-alpha.1 → 9.0.16
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/constants/unified.js +0 -29
- package/global-styles.js +1 -1
- package/package.json +1 -1
- package/services/tests/api.test.js +20 -35
- package/utils/commonUtils.js +1 -19
- package/v2Components/CapActionButton/constants.js +0 -7
- package/v2Components/CapActionButton/index.js +109 -168
- package/v2Components/CapActionButton/index.scss +5 -156
- package/v2Components/CapActionButton/messages.js +3 -19
- package/v2Components/CapActionButton/tests/index.test.js +18 -42
- package/v2Components/CapImageUpload/index.js +2 -2
- package/v2Components/CapTagList/index.js +0 -10
- package/v2Components/CommonTestAndPreview/CustomValuesEditor.js +48 -70
- package/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +2 -8
- package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +21 -214
- package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +0 -16
- package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +9 -83
- package/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +0 -30
- package/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +11 -60
- package/v2Components/CommonTestAndPreview/SendTestMessage.js +5 -10
- package/v2Components/CommonTestAndPreview/UnifiedPreview/RcsPreviewContent.js +23 -201
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +76 -355
- package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +8 -155
- package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +0 -11
- package/v2Components/CommonTestAndPreview/constants.js +2 -38
- package/v2Components/CommonTestAndPreview/index.js +222 -761
- package/v2Components/CommonTestAndPreview/messages.js +3 -45
- package/v2Components/CommonTestAndPreview/sagas.js +6 -25
- package/v2Components/CommonTestAndPreview/tests/CommonTestAndPreview.addTestCustomer.test.js +0 -1
- package/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +267 -284
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +65 -231
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +5 -118
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +0 -341
- package/v2Components/CommonTestAndPreview/tests/PreviewSection.test.js +1 -8
- package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +13 -34
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/RcsPreviewContent.test.js +283 -281
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +1 -199
- package/v2Components/CommonTestAndPreview/tests/index.test.js +4 -133
- package/v2Components/CommonTestAndPreview/tests/sagas.test.js +24 -31
- package/v2Components/TemplatePreview/_templatePreview.scss +22 -41
- package/v2Components/TemplatePreview/index.js +31 -143
- package/v2Components/TemplatePreview/tests/index.test.js +0 -142
- package/v2Components/TestAndPreviewSlidebox/CustomValuesEditor.js +6 -6
- package/v2Components/TestAndPreviewSlidebox/index.js +1 -13
- package/v2Components/TestAndPreviewSlidebox/sagas.js +4 -11
- package/v2Components/TestAndPreviewSlidebox/tests/saga.test.js +1 -3
- package/v2Containers/CommunicationFlow/Tests/CommunicationFlow.test.js +1 -4
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/DeliverySettingsSection.test.js +0 -4
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/SenderDetails.test.js +20 -20
- package/v2Containers/CreativesContainer/SlideBoxContent.js +7 -36
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +5 -14
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +5 -36
- package/v2Containers/CreativesContainer/constants.js +0 -11
- package/v2Containers/CreativesContainer/index.js +104 -323
- package/v2Containers/CreativesContainer/index.scss +1 -83
- package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +34 -79
- package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +16 -79
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +0 -8
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +90 -333
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +15 -20
- package/v2Containers/CreativesContainer/tests/index.test.js +9 -71
- package/v2Containers/Email/index.js +5 -2
- package/v2Containers/MobilePush/Create/test/saga.test.js +2 -2
- package/v2Containers/Rcs/constants.js +11 -131
- package/v2Containers/Rcs/index.js +810 -2605
- package/v2Containers/Rcs/index.scss +8 -289
- package/v2Containers/Rcs/messages.js +3 -34
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +38537 -73535
- package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap +8 -0
- package/v2Containers/Rcs/tests/index.test.js +36 -147
- package/v2Containers/Rcs/tests/mockData.js +0 -38
- package/v2Containers/Rcs/tests/utils.test.js +30 -646
- package/v2Containers/Rcs/utils.js +11 -478
- package/v2Containers/Sms/Create/index.js +48 -115
- package/v2Containers/SmsTrai/Create/index.js +4 -9
- package/v2Containers/SmsTrai/Edit/constants.js +0 -2
- package/v2Containers/SmsTrai/Edit/index.js +169 -678
- package/v2Containers/SmsTrai/Edit/messages.js +4 -14
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +2854 -5455
- package/v2Containers/SmsWrapper/index.js +8 -37
- package/v2Containers/TagList/index.js +0 -6
- package/v2Containers/Templates/_templates.scss +12 -171
- package/v2Containers/Templates/actions.js +0 -11
- package/v2Containers/Templates/constants.js +0 -2
- package/v2Containers/Templates/index.js +55 -125
- package/v2Containers/Templates/sagas.js +13 -57
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1015 -1060
- package/v2Containers/Templates/tests/sagas.test.js +16 -199
- package/v2Containers/TemplatesV2/TemplatesV2.style.js +1 -72
- package/v2Containers/TemplatesV2/index.js +23 -86
- package/v2Containers/WeChat/MapTemplates/test/saga.test.js +9 -9
- package/v2Containers/Whatsapp/index.js +20 -3
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +34 -578
- package/utils/rcsPayloadUtils.js +0 -92
- package/utils/templateVarUtils.js +0 -201
- package/utils/tests/rcsPayloadUtils.test.js +0 -226
- package/utils/tests/templateVarUtils.test.js +0 -204
- package/v2Components/CommonTestAndPreview/previewApiUtils.js +0 -59
- package/v2Components/CommonTestAndPreview/tests/previewApiUtils.test.js +0 -67
- package/v2Components/CommonTestAndPreview/utils.js +0 -84
- package/v2Components/SmsFallback/SmsFallbackLocalSelector.js +0 -91
- package/v2Components/SmsFallback/constants.js +0 -94
- package/v2Components/SmsFallback/index.js +0 -958
- package/v2Components/SmsFallback/index.scss +0 -266
- package/v2Components/SmsFallback/messages.js +0 -78
- package/v2Components/SmsFallback/smsFallbackUtils.js +0 -120
- package/v2Components/SmsFallback/tests/SmsFallbackLocalSelector.test.js +0 -50
- package/v2Components/SmsFallback/tests/rcsSmsFallback.acceptance.test.js +0 -147
- package/v2Components/SmsFallback/tests/smsFallbackHandlers.test.js +0 -304
- package/v2Components/SmsFallback/tests/smsFallbackUi.test.js +0 -208
- package/v2Components/SmsFallback/tests/smsFallbackUtils.test.js +0 -309
- package/v2Components/SmsFallback/tests/useLocalTemplateList.test.js +0 -422
- package/v2Components/SmsFallback/useLocalTemplateList.js +0 -92
- package/v2Components/TemplatePreview/constants.js +0 -2
- package/v2Components/VarSegmentMessageEditor/constants.js +0 -2
- package/v2Components/VarSegmentMessageEditor/index.js +0 -125
- package/v2Components/VarSegmentMessageEditor/index.scss +0 -46
- package/v2Containers/CreativesContainer/CreativesSlideBoxWrapper.js +0 -17
- package/v2Containers/CreativesContainer/embeddedSlideboxUtils.js +0 -79
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.localTemplates.test.js +0 -90
- package/v2Containers/CreativesContainer/tests/embeddedSlideboxUtils.test.js +0 -258
- package/v2Containers/CreativesContainer/tests/useLocalTemplatesProp.test.js +0 -125
- package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +0 -227
- package/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +0 -318
- package/v2Containers/Sms/smsFormDataHelpers.js +0 -67
- package/v2Containers/Sms/tests/smsFormDataHelpers.test.js +0 -253
- package/v2Containers/SmsTrai/Edit/index.scss +0 -126
- package/v2Containers/Templates/TemplatesActionBar.js +0 -101
- package/v2Containers/Templates/tests/TemplatesActionBar.test.js +0 -120
- package/v2Containers/Templates/tests/smsTemplatesListApi.test.js +0 -180
- package/v2Containers/Templates/utils/smsTemplatesListApi.js +0 -79
- package/v2Containers/TemplatesV2/tests/TemplatesV2.localTemplates.test.js +0 -131
|
@@ -24,7 +24,6 @@ import {getMessageObject} from '../../../utils/messageUtils';
|
|
|
24
24
|
import { gtmPush } from '../../../utils/gtmTrackers';
|
|
25
25
|
import * as creativesContainerActions from '../../CreativesContainer/actions';
|
|
26
26
|
import {SMS} from '../../CreativesContainer/constants';
|
|
27
|
-
import { EMBEDDED, FULL } from '../../SmsTrai/Edit/constants';
|
|
28
27
|
// import callNativeEvent from '../../../legacy/callNativeEvent';
|
|
29
28
|
import {showError} from '../commonMethods';
|
|
30
29
|
import withCreatives from '../../../hoc/withCreatives';
|
|
@@ -34,10 +33,6 @@ import injectReducer from '../../../utils/injectReducer';
|
|
|
34
33
|
import v2SmsCreateReducer from './reducer';
|
|
35
34
|
import * as globalActions from '../../Cap/actions';
|
|
36
35
|
import TestAndPreviewSlidebox from '../../../v2Components/TestAndPreviewSlidebox';
|
|
37
|
-
import {
|
|
38
|
-
getSmsEmbeddedFooterValidity,
|
|
39
|
-
getSmsMessageFromFormData,
|
|
40
|
-
} from '../smsFormDataHelpers';
|
|
41
36
|
|
|
42
37
|
export class Create extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
43
38
|
constructor(props) {
|
|
@@ -58,11 +53,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
58
53
|
isTestAndPreviewMode: false,
|
|
59
54
|
pendingGetFormData: false,
|
|
60
55
|
};
|
|
61
|
-
// Tracks the last validity value reported to SmsFallback so componentDidUpdate
|
|
62
|
-
// does not dispatch on every render and create an infinite update loop.
|
|
63
|
-
// Intentionally undefined (not true) so the first render always reports the
|
|
64
|
-
// real validity rather than assuming the form starts invalid.
|
|
65
|
-
this._lastReportedSmsFooterInvalid = undefined;
|
|
66
56
|
this.saveFormData = this.saveFormData.bind(this);
|
|
67
57
|
this.onFormDataChange = this.onFormDataChange.bind(this);
|
|
68
58
|
this.onTemplateNameChange = this.onTemplateNameChange.bind(this);
|
|
@@ -127,7 +117,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
127
117
|
// const module = this.props.location.query.module;
|
|
128
118
|
const name = this.props.route.name;
|
|
129
119
|
window.addEventListener("message", this.handleFrameTasks);
|
|
130
|
-
if (type ===
|
|
120
|
+
if (type === 'embedded') {
|
|
131
121
|
const response = {
|
|
132
122
|
action: 'startTemplateCreation',
|
|
133
123
|
window: name === 'view' ? 'view' : 'create',
|
|
@@ -168,44 +158,20 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
168
158
|
const query = {
|
|
169
159
|
layout: 'SMS',
|
|
170
160
|
type: 'TAG',
|
|
171
|
-
context: this.props.location.query.type ===
|
|
172
|
-
embedded: this.props.
|
|
173
|
-
? FULL
|
|
174
|
-
: (this.props.location.query.type === EMBEDDED ? this.props.location.query.type : FULL),
|
|
161
|
+
context: this.props.location.query.type === 'embedded' ? this.props.location.query.module : 'default',
|
|
162
|
+
embedded: this.props.location.query.type === 'embedded' ? this.props.location.query.type : 'full',
|
|
175
163
|
};
|
|
176
164
|
if (this.props.getDefaultTags) {
|
|
177
165
|
query.context = this.props.getDefaultTags;
|
|
178
166
|
}
|
|
179
167
|
this.props.globalActions.fetchSchemaForEntity(query);
|
|
180
|
-
if (this.props.location.query.type ===
|
|
168
|
+
if (this.props.location.query.type === 'embedded') {
|
|
181
169
|
this.showNext();
|
|
182
170
|
}
|
|
183
171
|
}
|
|
184
172
|
}
|
|
185
173
|
}
|
|
186
174
|
|
|
187
|
-
componentDidUpdate() {
|
|
188
|
-
if (!this.props.embeddedSmsFallback || typeof this.props.onEmbeddedSmsFooterValidity !== 'function') {
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
const validity = getSmsEmbeddedFooterValidity(this.state.formData, this.state.tabCount);
|
|
192
|
-
const isTemplateNameEmpty = !!validity.isTemplateNameEmpty;
|
|
193
|
-
const isMessageEmpty = !!validity.isMessageEmpty;
|
|
194
|
-
// Only dispatch when the validity tuple changes. Dispatching unconditionally caused
|
|
195
|
-
// an infinite loop: componentDidUpdate → dispatch → SmsFallback re-render →
|
|
196
|
-
// SmsCreate re-render → componentDidUpdate → ... even when state was unchanged.
|
|
197
|
-
// Tracking both fields individually (not just the combined isInvalid flag) ensures
|
|
198
|
-
// the parent receives an updated validity object when individual fields flip even
|
|
199
|
-
// while the combined invalid state stays the same (e.g. true→true with different fields).
|
|
200
|
-
if (
|
|
201
|
-
this._lastReportedSmsFooterTemplateNameEmpty === isTemplateNameEmpty &&
|
|
202
|
-
this._lastReportedSmsFooterMessageEmpty === isMessageEmpty
|
|
203
|
-
) return;
|
|
204
|
-
this._lastReportedSmsFooterTemplateNameEmpty = isTemplateNameEmpty;
|
|
205
|
-
this._lastReportedSmsFooterMessageEmpty = isMessageEmpty;
|
|
206
|
-
this.props.onEmbeddedSmsFooterValidity(validity);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
175
|
componentWillUnmount() {
|
|
210
176
|
if (this.pendingGetFormDataTimeout) {
|
|
211
177
|
clearTimeout(this.pendingGetFormDataTimeout);
|
|
@@ -287,7 +253,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
287
253
|
} else {
|
|
288
254
|
this.props.router.push({
|
|
289
255
|
pathname: `/sms/`,
|
|
290
|
-
query: type ===
|
|
256
|
+
query: type === 'embedded' ? {type: 'embedded', module} : {module},
|
|
291
257
|
});
|
|
292
258
|
}
|
|
293
259
|
}
|
|
@@ -309,10 +275,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
309
275
|
}
|
|
310
276
|
const result = {};
|
|
311
277
|
result.base = baseData;
|
|
312
|
-
/* Root field used by FormBuilder; embedded getFormSubscriptionData reads value.base */
|
|
313
|
-
if (formData['template-name'] !== undefined) {
|
|
314
|
-
result.base['template-name'] = formData['template-name'];
|
|
315
|
-
}
|
|
316
278
|
if (this.state.isValid) {
|
|
317
279
|
const msgObj = charCount.updateCharCount(baseData['sms-editor']);
|
|
318
280
|
result.base.msg_count = msgObj.msgCount;
|
|
@@ -455,7 +417,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
455
417
|
// const module = this.props.location.query.module ? this.props.location.query.module : 'default';
|
|
456
418
|
// this.props.router.push({
|
|
457
419
|
// pathname: `/sms/`,
|
|
458
|
-
// query: type ===
|
|
420
|
+
// query: type === 'embedded' ? {type: 'embedded', module} : {module},
|
|
459
421
|
// });
|
|
460
422
|
}
|
|
461
423
|
|
|
@@ -464,7 +426,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
464
426
|
const module = this.props.location.query.module ? this.props.location.query.module : 'default';
|
|
465
427
|
this.props.router.push({
|
|
466
428
|
pathname: `/sms/`,
|
|
467
|
-
query: type ===
|
|
429
|
+
query: type === 'embedded' ? {type: 'embedded', module} : {module},
|
|
468
430
|
});
|
|
469
431
|
}
|
|
470
432
|
|
|
@@ -479,7 +441,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
479
441
|
|
|
480
442
|
this.setState({schema, loadingStatus: this.state.loadingStatus + 1}, () => {
|
|
481
443
|
const type = this.props.location.query.type;
|
|
482
|
-
if (type ===
|
|
444
|
+
if (type === 'embedded') {
|
|
483
445
|
this.removeStandAlone();
|
|
484
446
|
}
|
|
485
447
|
});
|
|
@@ -922,9 +884,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
922
884
|
layout: 'SMS',
|
|
923
885
|
type: 'TAG',
|
|
924
886
|
context: (data && data.toLowerCase() === 'all') ? 'default' : (data && data.toLowerCase()),
|
|
925
|
-
embedded: this.props.
|
|
926
|
-
? FULL
|
|
927
|
-
: (this.props.location.query.type === EMBEDDED ? this.props.location.query.type : FULL),
|
|
887
|
+
embedded: this.props.location.query.type === 'embedded' ? this.props.location.query.type : 'full',
|
|
928
888
|
};
|
|
929
889
|
this.props.globalActions.fetchSchemaForEntity(query);
|
|
930
890
|
}
|
|
@@ -932,29 +892,11 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
932
892
|
removeStandAlone() {
|
|
933
893
|
const schema = _.cloneDeep(this.state.schema);
|
|
934
894
|
const childSections = _.get(schema, 'standalone.sections[0].childSections');
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
/*
|
|
941
|
-
* Creatives library drops the standalone template-name block because `SlideBoxHeader`
|
|
942
|
-
* shows the name. This is independent of the section count — guard it separately so
|
|
943
|
-
* it still runs even when childSections.length <= 2 (e.g. schema arrives pre-trimmed).
|
|
944
|
-
* RCS SMS fallback uses the same slidebox footer but keeps the name in the form.
|
|
945
|
-
*/
|
|
946
|
-
if (!this.props.embeddedSmsFallback) {
|
|
947
|
-
const fields = _.get(childSections, '[1].childSections[0].childSections');
|
|
948
|
-
if (fields && fields.length > 0) {
|
|
949
|
-
fields.splice(0, 1);
|
|
950
|
-
_.set(childSections, '[1].childSections[0].childSections', fields);
|
|
951
|
-
}
|
|
952
|
-
}
|
|
953
|
-
_.set(schema, 'standalone.sections[0].childSections', childSections);
|
|
954
|
-
}
|
|
955
|
-
// Always increment loadingStatus — isSmsLoading() requires >= 2 in library mode
|
|
956
|
-
// (isFullMode=false). The early return previously skipped this, leaving the
|
|
957
|
-
// spinner stuck forever when the schema had <= 2 childSections.
|
|
895
|
+
childSections.splice(2, 1);
|
|
896
|
+
const fields = _.get(childSections, '[1].childSections[0].childSections');//removing template name section
|
|
897
|
+
fields.splice(0, 1);
|
|
898
|
+
_.set(childSections, '[1].childSections[0].childSections', fields);
|
|
899
|
+
_.set(schema, 'standalone.sections[0].childSections', childSections);
|
|
958
900
|
this.setState({ schema, loadingStatus: this.state.loadingStatus + 1 });
|
|
959
901
|
}
|
|
960
902
|
|
|
@@ -999,8 +941,37 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
999
941
|
this.setState({startValidation: false});
|
|
1000
942
|
}
|
|
1001
943
|
|
|
1002
|
-
getTemplateContent = () =>
|
|
1003
|
-
|
|
944
|
+
getTemplateContent = () => {
|
|
945
|
+
// Get SMS content from formData
|
|
946
|
+
if (!this.state.formData || !Array.isArray(this.state.formData) || this.state.formData.length === 0) {
|
|
947
|
+
return '';
|
|
948
|
+
}
|
|
949
|
+
const currentTabData = this.state.formData[this.state.currentTab - 1];
|
|
950
|
+
if (!currentTabData) {
|
|
951
|
+
return '';
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
// PRIORITY 1: Check direct path first (most common for SMS)
|
|
955
|
+
// This handles: formData[0]['sms-editor']
|
|
956
|
+
if (currentTabData['sms-editor']) {
|
|
957
|
+
return currentTabData['sms-editor'];
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
// PRIORITY 2: Check activeTab structure (for versioned templates)
|
|
961
|
+
// This handles: formData[0][activeTab]['sms-editor']
|
|
962
|
+
const activeTab = currentTabData?.activeTab || 'base';
|
|
963
|
+
if (currentTabData[activeTab]?.['sms-editor']) {
|
|
964
|
+
return currentTabData[activeTab]['sms-editor'];
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
// PRIORITY 3: Check base explicitly (fallback)
|
|
968
|
+
// This handles: formData[0]['base']['sms-editor']
|
|
969
|
+
if (currentTabData['base']?.['sms-editor']) {
|
|
970
|
+
return currentTabData['base']['sms-editor'];
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
return '';
|
|
974
|
+
}
|
|
1004
975
|
|
|
1005
976
|
handleTestAndPreview = () => {
|
|
1006
977
|
// If parent is managing state (props exist), call parent handler
|
|
@@ -1029,35 +1000,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1029
1000
|
}
|
|
1030
1001
|
|
|
1031
1002
|
saveFormData() {
|
|
1032
|
-
/*
|
|
1033
|
-
* RCS SMS fallback slidebox (embeddedSmsFallback): parent passes isFullMode from RCS, but we must not
|
|
1034
|
-
* call createTemplate — that spins CapSpin on createTemplateInProgress and is not the embedded contract.
|
|
1035
|
-
* Same as library: hand off form payload via getFormSubscriptionData.
|
|
1036
|
-
*/
|
|
1037
|
-
if (this.props.embeddedSmsFallback && this.props.getFormSubscriptionData) {
|
|
1038
|
-
const { isTemplateNameEmpty, isMessageEmpty } = getSmsEmbeddedFooterValidity(
|
|
1039
|
-
this.state.formData,
|
|
1040
|
-
this.state.tabCount,
|
|
1041
|
-
);
|
|
1042
|
-
if (isTemplateNameEmpty || isMessageEmpty) {
|
|
1043
|
-
this.setState({ startValidation: true, pendingGetFormData: false });
|
|
1044
|
-
if (this.props.onValidationFail) {
|
|
1045
|
-
this.props.onValidationFail();
|
|
1046
|
-
}
|
|
1047
|
-
return;
|
|
1048
|
-
}
|
|
1049
|
-
const payload = this.getFormData();
|
|
1050
|
-
if (!payload.validity) {
|
|
1051
|
-
if (this.props.onValidationFail) {
|
|
1052
|
-
this.props.onValidationFail();
|
|
1053
|
-
}
|
|
1054
|
-
this.setState({ pendingGetFormData: false, startValidation: false });
|
|
1055
|
-
return;
|
|
1056
|
-
}
|
|
1057
|
-
this.props.getFormSubscriptionData(payload);
|
|
1058
|
-
this.setState({ pendingGetFormData: false, startValidation: false });
|
|
1059
|
-
return;
|
|
1060
|
-
}
|
|
1061
1003
|
// In library mode: FormBuilder calls onSubmit only after liquid validation succeeds.
|
|
1062
1004
|
// Submit to parent here so the slidebox can close with valid data.
|
|
1063
1005
|
if (!this.props.isFullMode) {
|
|
@@ -1110,7 +1052,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1110
1052
|
const spinning = this.isSmsLoading();
|
|
1111
1053
|
let tags = this.props.metaEntities && this.props.metaEntities.tags && this.props.metaEntities.tags.standard ? this.props.metaEntities.tags.standard : [];
|
|
1112
1054
|
|
|
1113
|
-
if (this.props.location.query.type ===
|
|
1055
|
+
if (this.props.location.query.type === 'embedded' && this.props.location.query.module === 'library' && !this.props.getDefaultTags) {
|
|
1114
1056
|
tags = this.props.supportedTags; // if get default tags is not present and supported tags is present use that inlbrary mode
|
|
1115
1057
|
}
|
|
1116
1058
|
return (
|
|
@@ -1157,9 +1099,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1157
1099
|
onTestContentClicked={this.props.onTestContentClicked}
|
|
1158
1100
|
onPreviewContentClicked={this.props.onPreviewContentClicked}
|
|
1159
1101
|
eventContextTags={this.props?.eventContextTags}
|
|
1160
|
-
|
|
1161
|
-
tagListPopoverOverlayStyle={this.props.tagListPopoverOverlayStyle}
|
|
1162
|
-
tagListPopoverOverlayClassName={this.props.tagListPopoverOverlayClassName}
|
|
1102
|
+
waitEventContextTags={this.props?.waitEventContextTags}
|
|
1163
1103
|
/>
|
|
1164
1104
|
</CapColumn>
|
|
1165
1105
|
</CapRow>
|
|
@@ -1172,7 +1112,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1172
1112
|
formData={this.state.formData}
|
|
1173
1113
|
content={this.getTemplateContent()}
|
|
1174
1114
|
currentChannel={SMS}
|
|
1175
|
-
smsRegister={this.props.smsRegister}
|
|
1176
1115
|
/>
|
|
1177
1116
|
</div>
|
|
1178
1117
|
);
|
|
@@ -1197,17 +1136,11 @@ Create.propTypes = {
|
|
|
1197
1136
|
isLoadingMetaEntities: PropTypes.bool,
|
|
1198
1137
|
selectedOfferDetails: PropTypes.array,
|
|
1199
1138
|
eventContextTags: PropTypes.array,
|
|
1139
|
+
waitEventContextTags: PropTypes.object,
|
|
1200
1140
|
showTestAndPreviewSlidebox: PropTypes.bool,
|
|
1201
1141
|
handleTestAndPreview: PropTypes.func,
|
|
1202
1142
|
handleCloseTestAndPreview: PropTypes.func,
|
|
1203
1143
|
isTestAndPreviewMode: PropTypes.bool,
|
|
1204
|
-
smsRegister: PropTypes.any,
|
|
1205
|
-
forceFullTagContext: PropTypes.bool,
|
|
1206
|
-
embeddedSmsFallback: PropTypes.bool,
|
|
1207
|
-
onEmbeddedSmsFooterValidity: PropTypes.func,
|
|
1208
|
-
tagListGetPopupContainer: PropTypes.func,
|
|
1209
|
-
tagListPopoverOverlayStyle: PropTypes.object,
|
|
1210
|
-
tagListPopoverOverlayClassName: PropTypes.string,
|
|
1211
1144
|
};
|
|
1212
1145
|
|
|
1213
1146
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -70,7 +70,6 @@ export const SmsTraiCreate = (props) => {
|
|
|
70
70
|
onCreateComplete,
|
|
71
71
|
isFullMode,
|
|
72
72
|
onShowTemplates,
|
|
73
|
-
embeddedSmsFallback,
|
|
74
73
|
traiSms: {
|
|
75
74
|
duplicateDetails = {},
|
|
76
75
|
duplicateDetailsError = '',
|
|
@@ -660,11 +659,9 @@ export const SmsTraiCreate = (props) => {
|
|
|
660
659
|
|
|
661
660
|
const createCallback = ({ errorMessage }) => {
|
|
662
661
|
if (!errorMessage) {
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
});
|
|
667
|
-
}
|
|
662
|
+
CapNotification.success({
|
|
663
|
+
message: formatMessage(messages.smsCreateNotification),
|
|
664
|
+
});
|
|
668
665
|
actions.clearCreateResponse();
|
|
669
666
|
} else {
|
|
670
667
|
CapNotification.error({
|
|
@@ -744,9 +741,7 @@ export const SmsTraiCreate = (props) => {
|
|
|
744
741
|
{ templates: savedData },
|
|
745
742
|
(resp, errorMessage) => {
|
|
746
743
|
createCallback({ errorMessage });
|
|
747
|
-
if (
|
|
748
|
-
if (!errorMessage) onCreateComplete(savedData);
|
|
749
|
-
} else if (isFullMode) {
|
|
744
|
+
if (isFullMode) {
|
|
750
745
|
onCreateComplete();
|
|
751
746
|
} else {
|
|
752
747
|
onShowTemplates();
|
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
export const CHARLIMIT = 40;
|
|
8
|
-
/** Display / soft cap label for DLT SMS body length (matches product UI). */
|
|
9
|
-
export const SMS_TRAI_CONTENT_MAX_LENGTH = 1024;
|
|
10
8
|
export const SMS = 'SMS';
|
|
11
9
|
export const SMS_TRAI_VAR = '{#var#}';
|
|
12
10
|
export const TAG = 'TAG';
|