@capillarytech/creatives-library 8.0.353-alpha.4 → 8.0.353-alpha.6
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 +29 -0
- package/package.json +1 -1
- package/services/tests/api.test.js +35 -20
- package/utils/commonUtils.js +19 -1
- package/utils/rcsPayloadUtils.js +92 -0
- package/utils/templateVarUtils.js +201 -0
- package/utils/tests/rcsPayloadUtils.test.js +226 -0
- package/utils/tests/templateVarUtils.test.js +204 -0
- package/v2Components/CapActionButton/constants.js +7 -0
- package/v2Components/CapActionButton/index.js +166 -108
- package/v2Components/CapActionButton/index.scss +157 -6
- package/v2Components/CapActionButton/messages.js +19 -3
- package/v2Components/CapActionButton/tests/index.test.js +41 -17
- package/v2Components/CapTagList/index.js +10 -0
- package/v2Components/CommonTestAndPreview/CustomValuesEditor.js +72 -49
- package/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +8 -2
- package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +213 -21
- package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +16 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +85 -10
- package/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +30 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +79 -11
- package/v2Components/CommonTestAndPreview/SendTestMessage.js +10 -5
- package/v2Components/CommonTestAndPreview/UnifiedPreview/RcsPreviewContent.js +157 -15
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +346 -76
- package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +133 -4
- package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +11 -0
- package/v2Components/CommonTestAndPreview/constants.js +38 -2
- package/v2Components/CommonTestAndPreview/index.js +691 -186
- package/v2Components/CommonTestAndPreview/messages.js +45 -3
- package/v2Components/CommonTestAndPreview/previewApiUtils.js +59 -0
- package/v2Components/CommonTestAndPreview/sagas.js +25 -6
- package/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +308 -284
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +231 -65
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +118 -5
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +341 -0
- package/v2Components/CommonTestAndPreview/tests/PreviewSection.test.js +8 -1
- package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +34 -13
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/RcsPreviewContent.test.js +281 -283
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +199 -1
- package/v2Components/CommonTestAndPreview/tests/index.test.js +132 -4
- package/v2Components/CommonTestAndPreview/tests/previewApiUtils.test.js +67 -0
- package/v2Components/CommonTestAndPreview/tests/sagas.test.js +36 -26
- package/v2Components/FormBuilder/index.js +74 -166
- package/v2Components/SmsFallback/SmsFallbackLocalSelector.js +91 -0
- package/v2Components/SmsFallback/constants.js +73 -0
- package/v2Components/SmsFallback/index.js +956 -0
- package/v2Components/SmsFallback/index.scss +265 -0
- package/v2Components/SmsFallback/messages.js +78 -0
- package/v2Components/SmsFallback/smsFallbackUtils.js +119 -0
- package/v2Components/SmsFallback/tests/SmsFallbackLocalSelector.test.js +50 -0
- package/v2Components/SmsFallback/tests/rcsSmsFallback.acceptance.test.js +147 -0
- package/v2Components/SmsFallback/tests/smsFallbackHandlers.test.js +304 -0
- package/v2Components/SmsFallback/tests/smsFallbackUi.test.js +223 -0
- package/v2Components/SmsFallback/tests/smsFallbackUtils.test.js +309 -0
- package/v2Components/SmsFallback/tests/useLocalTemplateList.test.js +422 -0
- package/v2Components/SmsFallback/useLocalTemplateList.js +92 -0
- package/v2Components/TemplatePreview/_templatePreview.scss +38 -23
- package/v2Components/TemplatePreview/constants.js +2 -0
- package/v2Components/TemplatePreview/index.js +143 -31
- package/v2Components/TemplatePreview/tests/index.test.js +142 -0
- package/v2Components/TestAndPreviewSlidebox/index.js +13 -1
- package/v2Components/TestAndPreviewSlidebox/sagas.js +11 -4
- package/v2Components/TestAndPreviewSlidebox/tests/saga.test.js +3 -1
- package/v2Components/VarSegmentMessageEditor/constants.js +2 -0
- package/v2Components/VarSegmentMessageEditor/index.js +125 -0
- package/v2Components/VarSegmentMessageEditor/index.scss +46 -0
- package/v2Containers/CreativesContainer/CreativesSlideBoxWrapper.js +43 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +36 -4
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +10 -1
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +29 -4
- package/v2Containers/CreativesContainer/constants.js +9 -0
- package/v2Containers/CreativesContainer/embeddedSlideboxUtils.js +79 -0
- package/v2Containers/CreativesContainer/index.js +346 -163
- package/v2Containers/CreativesContainer/index.scss +51 -1
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.localTemplates.test.js +90 -0
- package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +78 -34
- package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +79 -16
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +8 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +357 -98
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +20 -15
- package/v2Containers/CreativesContainer/tests/embeddedSlideboxUtils.test.js +258 -0
- package/v2Containers/CreativesContainer/tests/index.test.js +71 -9
- package/v2Containers/CreativesContainer/tests/useLocalTemplatesProp.test.js +125 -0
- package/v2Containers/Email/index.js +1 -1
- package/v2Containers/MobilePush/Create/test/saga.test.js +2 -2
- package/v2Containers/Rcs/constants.js +119 -10
- package/v2Containers/Rcs/index.js +2445 -813
- package/v2Containers/Rcs/index.scss +280 -8
- package/v2Containers/Rcs/messages.js +34 -3
- package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +225 -0
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +98018 -70073
- package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap +0 -5
- package/v2Containers/Rcs/tests/index.test.js +152 -121
- package/v2Containers/Rcs/tests/mockData.js +38 -0
- package/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +318 -0
- package/v2Containers/Rcs/tests/utils.test.js +646 -30
- package/v2Containers/Rcs/utils.js +478 -11
- package/v2Containers/Sms/Create/index.js +106 -40
- package/v2Containers/Sms/smsFormDataHelpers.js +67 -0
- package/v2Containers/Sms/tests/smsFormDataHelpers.test.js +253 -0
- package/v2Containers/SmsTrai/Create/index.js +9 -4
- package/v2Containers/SmsTrai/Edit/constants.js +2 -0
- package/v2Containers/SmsTrai/Edit/index.js +640 -130
- package/v2Containers/SmsTrai/Edit/index.scss +121 -0
- package/v2Containers/SmsTrai/Edit/messages.js +14 -4
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4328 -2375
- package/v2Containers/SmsWrapper/index.js +37 -8
- package/v2Containers/TagList/index.js +6 -0
- package/v2Containers/Templates/TemplatesActionBar.js +101 -0
- package/v2Containers/Templates/_templates.scss +166 -9
- package/v2Containers/Templates/actions.js +11 -0
- package/v2Containers/Templates/constants.js +2 -0
- package/v2Containers/Templates/index.js +120 -52
- package/v2Containers/Templates/sagas.js +56 -12
- package/v2Containers/Templates/tests/TemplatesActionBar.test.js +120 -0
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1062 -1017
- package/v2Containers/Templates/tests/sagas.test.js +199 -16
- package/v2Containers/Templates/tests/smsTemplatesListApi.test.js +180 -0
- package/v2Containers/Templates/utils/smsTemplatesListApi.js +79 -0
- package/v2Containers/TemplatesV2/TemplatesV2.style.js +72 -1
- package/v2Containers/TemplatesV2/index.js +86 -23
- package/v2Containers/TemplatesV2/tests/TemplatesV2.localTemplates.test.js +131 -0
- package/v2Containers/WeChat/MapTemplates/test/saga.test.js +9 -9
- package/v2Containers/Whatsapp/index.js +3 -20
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +578 -34
|
@@ -37,6 +37,7 @@ import { createStructuredSelector } from 'reselect';
|
|
|
37
37
|
import { CAP_SPACE_12, CAP_SPACE_08, FONT_COLOR_05, FONT_COLOR_04 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
38
38
|
import UnifiedPreview from '../CommonTestAndPreview/UnifiedPreview';
|
|
39
39
|
import { ANDROID } from '../CommonTestAndPreview/constants';
|
|
40
|
+
import TemplatePreview from '../TemplatePreview';
|
|
40
41
|
import TagList from '../../v2Containers/TagList';
|
|
41
42
|
import CapTagListWithInput from '../CapTagListWithInput';
|
|
42
43
|
import SlideBox from '../SlideBox';
|
|
@@ -79,69 +80,6 @@ const errorMessageForTags = {
|
|
|
79
80
|
TAG_BRACKET_COUNT_MISMATCH_ERROR: 'tagBracketCountMismatchError'
|
|
80
81
|
};
|
|
81
82
|
|
|
82
|
-
// Isolated input for EMAIL template-name: only this tiny component re-renders on each keystroke.
|
|
83
|
-
// formData is updated only on blur (onCommit), eliminating all re-renders during typing.
|
|
84
|
-
class HighFreqInput extends React.Component {
|
|
85
|
-
constructor(props) {
|
|
86
|
-
super(props);
|
|
87
|
-
this.state = { localValue: props.value || '' };
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
componentDidUpdate(prevProps) {
|
|
91
|
-
if (prevProps.value !== this.props.value && this.state.localValue !== this.props.value) {
|
|
92
|
-
this.setState({ localValue: this.props.value || '' });
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
handleChange = (e) => {
|
|
97
|
-
this.setState({ localValue: e.target.value });
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
handleBlur = (e) => {
|
|
101
|
-
this.props.onCommit(this.state.localValue);
|
|
102
|
-
if (this.props.onBlur) this.props.onBlur(e);
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
render() {
|
|
106
|
-
const { value: _v, onCommit: _oc, onBlur: _ob, ...rest } = this.props;
|
|
107
|
-
return <CapInput {...rest} value={this.state.localValue} onChange={this.handleChange} onBlur={this.handleBlur} />;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// Isolated wrapper for EMAIL template-subject: blur-only commit, same as HighFreqInput.
|
|
112
|
-
class HighFreqTagInput extends React.Component {
|
|
113
|
-
constructor(props) {
|
|
114
|
-
super(props);
|
|
115
|
-
this.state = { localInputValue: props.inputValue || '' };
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
componentDidUpdate(prevProps) {
|
|
119
|
-
if (prevProps.inputValue !== this.props.inputValue && this.state.localInputValue !== this.props.inputValue) {
|
|
120
|
-
this.setState({ localInputValue: this.props.inputValue || '' });
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
handleInputChange = (e) => {
|
|
125
|
-
this.setState({ localInputValue: e.target.value });
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
handleBlur = () => {
|
|
129
|
-
this.props.onCommit(this.state.localInputValue);
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
render() {
|
|
133
|
-
const { inputValue: _iv, onCommit: _oc, inputOnChange: _ic, ...rest } = this.props;
|
|
134
|
-
return (
|
|
135
|
-
<CapTagListWithInput
|
|
136
|
-
{...rest}
|
|
137
|
-
inputValue={this.state.localInputValue}
|
|
138
|
-
inputOnChange={this.handleInputChange}
|
|
139
|
-
inputProps={{ ...(this.props.inputProps || {}), onBlur: this.handleBlur }}
|
|
140
|
-
/>
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
83
|
class FormBuilder extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
146
84
|
constructor(props) {
|
|
147
85
|
super(props);
|
|
@@ -415,7 +353,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
415
353
|
this.setState({tabCount: nextProps.tabCount});
|
|
416
354
|
}
|
|
417
355
|
if (nextProps.startValidation && nextProps.startValidation !== false && this.props.startValidation !== nextProps.startValidation) {
|
|
418
|
-
if (this.debouncedUpdateFormData) this.debouncedUpdateFormData.flush();
|
|
419
356
|
this.setState({checkValidation: true});
|
|
420
357
|
this.validateForm(null, null, true, true, () => {
|
|
421
358
|
//triggering the saveFormData or onSubmit when validation sets isFormValid to TRUE
|
|
@@ -3053,8 +2990,8 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3053
2990
|
userLocale={this.props.userLocale}
|
|
3054
2991
|
selectedOfferDetails={this.props.selectedOfferDetails}
|
|
3055
2992
|
eventContextTags={this.props?.eventContextTags}
|
|
3056
|
-
restrictPersonalization={this.props.restrictPersonalization}
|
|
3057
2993
|
waitEventContextTags={this.props?.waitEventContextTags}
|
|
2994
|
+
restrictPersonalization={this.props.restrictPersonalization}
|
|
3058
2995
|
/>
|
|
3059
2996
|
</CapColumn>
|
|
3060
2997
|
);
|
|
@@ -3474,62 +3411,40 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3474
3411
|
? formatMessage(messages.personalizationTagsErrorMessage)
|
|
3475
3412
|
: (errorType === TAG_BRACKET_COUNT_MISMATCH_ERROR ? formatMessage(globalMessages.unbalanacedCurlyBraces) : (val.errorMessage && ifError ? val.errorMessage : ''));
|
|
3476
3413
|
if (styling === 'semantic') {
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
value={value || ""}
|
|
3512
|
-
defaultValue={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
|
|
3513
|
-
disabled={val.disabled}
|
|
3514
|
-
size={val.size || "default"}
|
|
3515
|
-
/>
|
|
3516
|
-
{this.props.schema?.channel === EMAIL &&
|
|
3517
|
-
!aiContentBotDisabled && (
|
|
3518
|
-
<CapAskAira.ContentGenerationBot
|
|
3519
|
-
text={value || ""}
|
|
3520
|
-
setText={this.handleSetText.bind(this, val)}
|
|
3521
|
-
iconPlacement="float-br"
|
|
3522
|
-
iconSize="1.6rem"
|
|
3523
|
-
rootStyle={{
|
|
3524
|
-
bottom: "0.2rem",
|
|
3525
|
-
right: "0.2rem",
|
|
3526
|
-
left: "auto",
|
|
3527
|
-
}}
|
|
3528
|
-
/>
|
|
3529
|
-
)}
|
|
3530
|
-
</CapColumn>
|
|
3531
|
-
);
|
|
3532
|
-
}
|
|
3414
|
+
columns.push(
|
|
3415
|
+
<CapColumn key={val.id} span={val.width} offset={val.offset} style={val.style || {}}>
|
|
3416
|
+
<CapInput
|
|
3417
|
+
id={val.id}
|
|
3418
|
+
errorMessage={errorMessageText}
|
|
3419
|
+
label={val.label}
|
|
3420
|
+
inductiveText={val.inductiveText}
|
|
3421
|
+
className={`input-primary chart-name-input${ifError ? ' error' : ''}`}
|
|
3422
|
+
// fluid={val.fluid}
|
|
3423
|
+
style={val.style ? val.style : {}}
|
|
3424
|
+
placeholder={val.placeholder}
|
|
3425
|
+
onChange={(e) => this.updateFormData(e.target.value, val)}
|
|
3426
|
+
onBlur={(e) => this.handleFieldBlur(e, val)}
|
|
3427
|
+
value={value || ""}
|
|
3428
|
+
defaultValue={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
|
|
3429
|
+
disabled={val.disabled}
|
|
3430
|
+
size={val.size || "default"}
|
|
3431
|
+
/>
|
|
3432
|
+
{this.props.schema?.channel === EMAIL &&
|
|
3433
|
+
!aiContentBotDisabled && (
|
|
3434
|
+
<CapAskAira.ContentGenerationBot
|
|
3435
|
+
text={value || ""}
|
|
3436
|
+
setText={this.handleSetText.bind(this, val)}
|
|
3437
|
+
iconPlacement="float-br"
|
|
3438
|
+
iconSize="1.6rem"
|
|
3439
|
+
rootStyle={{
|
|
3440
|
+
bottom: "0.2rem",
|
|
3441
|
+
right: "0.2rem",
|
|
3442
|
+
left: "auto",
|
|
3443
|
+
}}
|
|
3444
|
+
/>
|
|
3445
|
+
)}
|
|
3446
|
+
</CapColumn>
|
|
3447
|
+
);
|
|
3533
3448
|
}
|
|
3534
3449
|
break;
|
|
3535
3450
|
|
|
@@ -3745,8 +3660,11 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3745
3660
|
selectedOfferDetails={this.props.selectedOfferDetails}
|
|
3746
3661
|
channel={channel}
|
|
3747
3662
|
eventContextTags={this.props?.eventContextTags}
|
|
3748
|
-
restrictPersonalization={this.props.restrictPersonalization}
|
|
3749
3663
|
waitEventContextTags={this.props?.waitEventContextTags}
|
|
3664
|
+
restrictPersonalization={this.props.restrictPersonalization}
|
|
3665
|
+
getPopupContainer={this.props.tagListGetPopupContainer}
|
|
3666
|
+
popoverOverlayStyle={this.props.tagListPopoverOverlayStyle}
|
|
3667
|
+
popoverOverlayClassName={this.props.tagListPopoverOverlayClassName}
|
|
3750
3668
|
/>
|
|
3751
3669
|
</CapColumn>
|
|
3752
3670
|
);
|
|
@@ -3770,48 +3688,37 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3770
3688
|
isBEEAppEnableForCapTagList === false ||
|
|
3771
3689
|
channelForCapTagList !== 'EMAIL'
|
|
3772
3690
|
) {
|
|
3773
|
-
const isEmailStandaloneSubject = val.standalone && channelForCapTagList === 'EMAIL' && val.id === 'template-subject';
|
|
3774
|
-
const tagListProps = {
|
|
3775
|
-
key: `input-${val.id}`,
|
|
3776
|
-
inputId: val.id,
|
|
3777
|
-
inputValue: this.state.formData[val.id] || '',
|
|
3778
|
-
inputPlaceholder: val.placeholder || '',
|
|
3779
|
-
inputErrorMessage: val.errorMessage && ifError ? val.errorMessage : '',
|
|
3780
|
-
inputRequired: val.required || false,
|
|
3781
|
-
inputDisabled: val.disabled || false,
|
|
3782
|
-
headingText: val.label || '',
|
|
3783
|
-
headingStyle: val.headingStyle || { marginTop: '3%', marginRight: '79%' },
|
|
3784
|
-
headingType: "h4",
|
|
3785
|
-
onTagSelect: (data) => this.callChildEvent(data, val, 'onTagSelect'),
|
|
3786
|
-
onContextChange: this.props.onContextChange,
|
|
3787
|
-
location: this.props.location,
|
|
3788
|
-
tags: this.props.tags ? this.props.tags : [],
|
|
3789
|
-
injectedTags: this.props.injectedTags ? this.props.injectedTags : {},
|
|
3790
|
-
className: val.className ? val.className : '',
|
|
3791
|
-
userLocale: this.state.translationLang,
|
|
3792
|
-
selectedOfferDetails: this.props.selectedOfferDetails,
|
|
3793
|
-
eventContextTags: this.props?.eventContextTags,
|
|
3794
|
-
waitEventContextTags: this.props?.waitEventContextTags,
|
|
3795
|
-
moduleFilterEnabled: moduleFilterEnabledForCapTagList,
|
|
3796
|
-
containerStyle: val.style || {},
|
|
3797
|
-
inputProps: val.inputProps || {},
|
|
3798
|
-
showInput: val.showInput !== false,
|
|
3799
|
-
showTagList: val.showTagList !== false,
|
|
3800
|
-
restrictPersonalization: this.props.restrictPersonalization,
|
|
3801
|
-
};
|
|
3802
3691
|
columns.push(
|
|
3803
3692
|
<CapColumn key={`input-${val.id}`} offset={val.offset} span={val.width ? val.width : ''} style={val.style ? val.style : {marginBottom: '16px'}}>
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3693
|
+
<CapTagListWithInput
|
|
3694
|
+
key={`input-${val.id}`}
|
|
3695
|
+
inputId={val.id}
|
|
3696
|
+
inputValue={this.state.formData[val.id] || ''}
|
|
3697
|
+
inputOnChange={(e) => this.updateFormData(e.target.value, val)}
|
|
3698
|
+
inputPlaceholder={val.placeholder || ''}
|
|
3699
|
+
inputErrorMessage={val.errorMessage && ifError ? val.errorMessage : ''}
|
|
3700
|
+
inputRequired={val.required || false}
|
|
3701
|
+
inputDisabled={val.disabled || false}
|
|
3702
|
+
headingText={val.label || ''}
|
|
3703
|
+
headingStyle={val.headingStyle || { marginTop: '3%', marginRight: '79%' }}
|
|
3704
|
+
headingType="h4"
|
|
3705
|
+
onTagSelect={(data) => this.callChildEvent(data, val, 'onTagSelect')}
|
|
3706
|
+
onContextChange={this.props.onContextChange}
|
|
3707
|
+
location={this.props.location}
|
|
3708
|
+
tags={this.props.tags ? this.props.tags : []}
|
|
3709
|
+
injectedTags={this.props.injectedTags ? this.props.injectedTags : {}}
|
|
3710
|
+
className={val.className ? val.className : ''}
|
|
3711
|
+
userLocale={this.state.translationLang}
|
|
3712
|
+
selectedOfferDetails={this.props.selectedOfferDetails}
|
|
3713
|
+
eventContextTags={this.props?.eventContextTags}
|
|
3714
|
+
waitEventContextTags={this.props?.waitEventContextTags}
|
|
3715
|
+
moduleFilterEnabled={moduleFilterEnabledForCapTagList}
|
|
3716
|
+
containerStyle={val.style || {}}
|
|
3717
|
+
inputProps={val.inputProps || {}}
|
|
3718
|
+
showInput={val.showInput !== false}
|
|
3719
|
+
showTagList={val.showTagList !== false}
|
|
3720
|
+
restrictPersonalization={this.props.restrictPersonalization}
|
|
3721
|
+
/>
|
|
3815
3722
|
</CapColumn>
|
|
3816
3723
|
);
|
|
3817
3724
|
}
|
|
@@ -4100,8 +4007,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
4100
4007
|
moduleFilterEnabled={isModuleFilterEnabled}
|
|
4101
4008
|
eventContextTags={this.props?.eventContextTags}
|
|
4102
4009
|
waitEventContextTags={this.props?.waitEventContextTags}
|
|
4103
|
-
isGetBeeData={this.props?.isGetBeeData}
|
|
4104
|
-
getBEEData={this.props?.getBEEData}
|
|
4105
4010
|
/>
|
|
4106
4011
|
</CapColumn>
|
|
4107
4012
|
);
|
|
@@ -4404,8 +4309,8 @@ FormBuilder.defaultProps = {
|
|
|
4404
4309
|
userLocale: localStorage.getItem('jlocale') || 'en',
|
|
4405
4310
|
showLiquidErrorInFooter: () => {},
|
|
4406
4311
|
metaDataStatus: "",
|
|
4407
|
-
waitEventContextTags: {},
|
|
4408
4312
|
isTestAndPreviewMode: false, // Default to false to maintain existing behavior
|
|
4313
|
+
waitEventContextTags: {},
|
|
4409
4314
|
};
|
|
4410
4315
|
|
|
4411
4316
|
FormBuilder.propTypes = {
|
|
@@ -4453,13 +4358,16 @@ FormBuilder.propTypes = {
|
|
|
4453
4358
|
type: PropTypes.string.isRequired,
|
|
4454
4359
|
isEmailLoading: PropTypes.bool.isRequired,
|
|
4455
4360
|
moduleType: PropTypes.string.isRequired,
|
|
4456
|
-
showLiquidErrorInFooter: PropTypes.
|
|
4361
|
+
showLiquidErrorInFooter: PropTypes.func.isRequired,
|
|
4457
4362
|
eventContextTags: PropTypes.array.isRequired,
|
|
4458
4363
|
waitEventContextTags: PropTypes.object,
|
|
4459
4364
|
forwardedTags: PropTypes.object.isRequired,
|
|
4460
4365
|
isLoyaltyModule: PropTypes.bool.isRequired,
|
|
4461
4366
|
isTestAndPreviewMode: PropTypes.bool, // Add new prop type
|
|
4462
4367
|
restrictPersonalization: PropTypes.bool,
|
|
4368
|
+
tagListGetPopupContainer: PropTypes.func,
|
|
4369
|
+
tagListPopoverOverlayStyle: PropTypes.object,
|
|
4370
|
+
tagListPopoverOverlayClassName: PropTypes.string,
|
|
4463
4371
|
};
|
|
4464
4372
|
|
|
4465
4373
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import CreativesContainer from '../../v2Containers/CreativesContainer';
|
|
4
|
+
import CapPageSpinner from '../CapPageSpinner';
|
|
5
|
+
import {
|
|
6
|
+
EMBEDDED_SMS_CREATIVES_LOCATION,
|
|
7
|
+
SMS_FALLBACK_CHANNEL_KEY,
|
|
8
|
+
SMS_FALLBACK_CREATIVE_EDITOR,
|
|
9
|
+
SMS_FALLBACK_ENABLE_NEW_CHANNELS,
|
|
10
|
+
} from './constants';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Reuse the exact embedded CreativesContainer SMS flow (same as normal SMS create).
|
|
14
|
+
* Avoid overriding Templates with local config so "Create new" follows built-in createTemplate path.
|
|
15
|
+
*/
|
|
16
|
+
export function SmsFallbackLocalSelector({
|
|
17
|
+
hidden,
|
|
18
|
+
fetchDetailsLoading,
|
|
19
|
+
templateList,
|
|
20
|
+
channelsToHide,
|
|
21
|
+
smsRegister,
|
|
22
|
+
onCloseCreatives,
|
|
23
|
+
onSelectTemplate,
|
|
24
|
+
filterContent,
|
|
25
|
+
location,
|
|
26
|
+
/** Required when user completes embedded SMS create/edit — `CreativesContainer` calls this on save (see `processCentralCommsMetaId`). */
|
|
27
|
+
getCreativesData,
|
|
28
|
+
}) {
|
|
29
|
+
const rootClassName = [
|
|
30
|
+
'sms-fallback-selector',
|
|
31
|
+
hidden ? 'sms-fallback-selector--visually-hidden' : '',
|
|
32
|
+
]
|
|
33
|
+
.filter(Boolean)
|
|
34
|
+
.join(' ');
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<div
|
|
38
|
+
className={rootClassName}
|
|
39
|
+
aria-hidden={hidden}
|
|
40
|
+
inert={hidden ? '' : undefined}
|
|
41
|
+
>
|
|
42
|
+
{fetchDetailsLoading && (
|
|
43
|
+
<div className="sms-fallback-selector__loading" aria-busy="true" aria-live="polite">
|
|
44
|
+
<CapPageSpinner spinning />
|
|
45
|
+
</div>
|
|
46
|
+
)}
|
|
47
|
+
<CreativesContainer
|
|
48
|
+
creativesMode="create"
|
|
49
|
+
location={location || EMBEDDED_SMS_CREATIVES_LOCATION}
|
|
50
|
+
templateData={null}
|
|
51
|
+
handleCloseCreatives={onCloseCreatives}
|
|
52
|
+
isFullMode={false}
|
|
53
|
+
smsRegister={smsRegister}
|
|
54
|
+
editor={SMS_FALLBACK_CREATIVE_EDITOR}
|
|
55
|
+
enableNewChannels={SMS_FALLBACK_ENABLE_NEW_CHANNELS}
|
|
56
|
+
channel={SMS_FALLBACK_CHANNEL_KEY}
|
|
57
|
+
channelsToHide={channelsToHide}
|
|
58
|
+
selectedBadges={[]}
|
|
59
|
+
localTemplatesConfig={{
|
|
60
|
+
useLocalTemplates: true,
|
|
61
|
+
localTemplates: templateList.templates,
|
|
62
|
+
localTemplatesLoading: templateList.loading,
|
|
63
|
+
localTemplatesFilterContent: filterContent,
|
|
64
|
+
localTemplatesOnPageChange: templateList.loadMore,
|
|
65
|
+
localTemplatesUseSkeleton: true,
|
|
66
|
+
}}
|
|
67
|
+
onSelectTemplate={onSelectTemplate}
|
|
68
|
+
getCreativesData={getCreativesData}
|
|
69
|
+
/>
|
|
70
|
+
</div>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
SmsFallbackLocalSelector.propTypes = {
|
|
75
|
+
hidden: PropTypes.bool,
|
|
76
|
+
fetchDetailsLoading: PropTypes.bool,
|
|
77
|
+
templateList: PropTypes.shape({
|
|
78
|
+
templates: PropTypes.array,
|
|
79
|
+
loading: PropTypes.bool,
|
|
80
|
+
loadMore: PropTypes.func,
|
|
81
|
+
}).isRequired,
|
|
82
|
+
channelsToHide: PropTypes.arrayOf(PropTypes.string),
|
|
83
|
+
smsRegister: PropTypes.any,
|
|
84
|
+
onCloseCreatives: PropTypes.func.isRequired,
|
|
85
|
+
onSelectTemplate: PropTypes.func.isRequired,
|
|
86
|
+
filterContent: PropTypes.node,
|
|
87
|
+
location: PropTypes.object,
|
|
88
|
+
getCreativesData: PropTypes.func.isRequired,
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export default SmsFallbackLocalSelector;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import {
|
|
2
|
+
WHATSAPP,
|
|
3
|
+
RCS,
|
|
4
|
+
ZALO,
|
|
5
|
+
WEBPUSH,
|
|
6
|
+
} from '../../v2Containers/CreativesContainer/constants';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* View modes for the SMS fallback slidebox (template list, create, edit).
|
|
10
|
+
* Used by SmsFallback and any channel that reuses it (RCS, etc.).
|
|
11
|
+
*/
|
|
12
|
+
export const SMS_FALLBACK_VIEW = {
|
|
13
|
+
SELECTING: 'selecting',
|
|
14
|
+
CREATING: 'creating',
|
|
15
|
+
EDITING: 'editing',
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Channel keys to hide in TemplatesV2 so only SMS tab is shown.
|
|
20
|
+
* Uses normalized keys matching TemplatesV2 pane.key normalization (lowercase).
|
|
21
|
+
* Parent can override via channelsToHide prop.
|
|
22
|
+
*/
|
|
23
|
+
export const CHANNELS_TO_HIDE_FOR_SMS_ONLY = [
|
|
24
|
+
'email',
|
|
25
|
+
'mobilepush',
|
|
26
|
+
'webpush',
|
|
27
|
+
'viber',
|
|
28
|
+
'whatsapp',
|
|
29
|
+
'zalo',
|
|
30
|
+
'facebook',
|
|
31
|
+
'rcs',
|
|
32
|
+
'inapp',
|
|
33
|
+
'line',
|
|
34
|
+
'wechat',
|
|
35
|
+
'call_task',
|
|
36
|
+
'ftp',
|
|
37
|
+
'assets',
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
/** DLT category filter values — aligned with Templates `SMS_FILTERS` / `filterSMSTemplates`. */
|
|
41
|
+
export const SMS_CATEGORY_FILTERS = {
|
|
42
|
+
ALL: 'all',
|
|
43
|
+
PROMOTIONAL: 'promo',
|
|
44
|
+
SERVICE_EXPLICIT: 'explicit',
|
|
45
|
+
SERVICE_IMPLICIT: 'implicit',
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/** `location` for embedded SMS creatives picker (CreativesContainer / TemplatesV2). */
|
|
49
|
+
export const EMBEDDED_SMS_CREATIVES_LOCATION = {
|
|
50
|
+
pathname: '/sms/create',
|
|
51
|
+
query: { type: 'embedded', module: 'library' },
|
|
52
|
+
search: '',
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/** `location` for embedded SMS TRAI edit inside slidebox. */
|
|
56
|
+
export const EMBEDDED_SMS_CREATIVES_EDIT_LOCATION = {
|
|
57
|
+
pathname: '/sms/edit',
|
|
58
|
+
query: { type: 'embedded', module: 'library' },
|
|
59
|
+
search: '',
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/** API `channel` param for `getTemplateDetails` when loading an SMS template by id. */
|
|
63
|
+
export const SMS_TEMPLATE_DETAILS_API_CHANNEL = 'Sms';
|
|
64
|
+
|
|
65
|
+
export const SMS_FALLBACK_CREATIVE_EDITOR = 'BEE';
|
|
66
|
+
|
|
67
|
+
export const SMS_FALLBACK_CHANNEL_KEY = 'sms';
|
|
68
|
+
|
|
69
|
+
/** Route shape passed to SmsWrapper / SmsTraiEdit for embedded SMS flows. */
|
|
70
|
+
export const SMS_FALLBACK_ROUTE = { name: SMS_FALLBACK_CHANNEL_KEY };
|
|
71
|
+
|
|
72
|
+
/** Channels enabled in the SMS-only embedded picker (hide others via `channelsToHide`). */
|
|
73
|
+
export const SMS_FALLBACK_ENABLE_NEW_CHANNELS = [WHATSAPP, RCS, ZALO, WEBPUSH];
|