@capillarytech/creatives-library 8.0.234 → 8.0.236-alpha.0
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/assets/Android.png +0 -0
- package/assets/iOS.png +0 -0
- package/constants/unified.js +1 -1
- package/initialReducer.js +2 -0
- package/package.json +1 -1
- package/services/api.js +5 -0
- package/services/tests/api.test.js +18 -0
- package/utils/common.js +1 -2
- package/utils/commonUtils.js +14 -1
- package/utils/transformTemplateConfig.js +0 -10
- package/v2Components/CapDeviceContent/index.js +61 -56
- package/v2Components/CapTagList/index.js +4 -0
- package/v2Components/HtmlEditor/HTMLEditor.js +165 -80
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +532 -0
- package/v2Components/HtmlEditor/_htmlEditor.scss +0 -4
- package/v2Components/HtmlEditor/_index.lazy.scss +0 -1
- package/v2Components/HtmlEditor/components/CodeEditorPane/_codeEditorPane.scss +0 -98
- package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +125 -148
- package/v2Components/HtmlEditor/components/DeviceToggle/_deviceToggle.scss +1 -0
- package/v2Components/HtmlEditor/components/DeviceToggle/index.js +3 -3
- package/v2Components/HtmlEditor/components/InAppPreviewPane/DeviceFrame.js +4 -7
- package/v2Components/HtmlEditor/components/InAppPreviewPane/__tests__/DeviceFrame.test.js +35 -45
- package/v2Components/HtmlEditor/components/InAppPreviewPane/_inAppPreviewPane.scss +1 -3
- package/v2Components/HtmlEditor/components/InAppPreviewPane/constants.js +33 -33
- package/v2Components/HtmlEditor/components/InAppPreviewPane/index.js +7 -6
- package/v2Components/HtmlEditor/constants.js +29 -20
- package/v2Components/HtmlEditor/hooks/__tests__/useInAppContent.test.js +158 -17
- package/v2Components/HtmlEditor/hooks/useInAppContent.js +53 -143
- package/v2Components/HtmlEditor/index.js +1 -1
- package/v2Components/HtmlEditor/messages.js +85 -85
- package/v2Components/MobilePushPreviewV2/index.js +32 -7
- package/v2Components/TemplatePreview/_templatePreview.scss +31 -21
- package/v2Components/TemplatePreview/index.js +47 -32
- package/v2Components/TemplatePreview/messages.js +4 -0
- package/v2Containers/BeeEditor/index.js +82 -80
- package/v2Containers/BeePopupEditor/constants.js +10 -0
- package/v2Containers/BeePopupEditor/index.js +180 -0
- package/v2Containers/BeePopupEditor/tests/index.test.js +627 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +69 -34
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +2 -1
- package/v2Containers/CreativesContainer/constants.js +1 -0
- package/v2Containers/CreativesContainer/index.js +65 -13
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +4 -12
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +15 -0
- package/v2Containers/InApp/__tests__/InAppHTMLEditor.test.js +376 -0
- package/v2Containers/InApp/__tests__/sagas.test.js +363 -0
- package/v2Containers/InApp/actions.js +7 -0
- package/v2Containers/InApp/constants.js +18 -4
- package/v2Containers/InApp/index.js +642 -355
- package/v2Containers/InApp/index.scss +4 -3
- package/v2Containers/InApp/messages.js +7 -3
- package/v2Containers/InApp/reducer.js +21 -3
- package/v2Containers/InApp/sagas.js +29 -9
- package/v2Containers/InApp/selectors.js +25 -5
- package/v2Containers/InApp/tests/index.test.js +154 -50
- package/v2Containers/InApp/tests/reducer.test.js +34 -0
- package/v2Containers/InApp/tests/sagas.test.js +61 -9
- package/v2Containers/InApp/tests/selectors.test.js +612 -0
- package/v2Containers/InAppWrapper/components/InAppWrapperView.js +159 -0
- package/v2Containers/InAppWrapper/components/__tests__/InAppWrapperView.test.js +256 -0
- package/v2Containers/InAppWrapper/constants.js +16 -0
- package/v2Containers/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +473 -0
- package/v2Containers/InAppWrapper/hooks/useInAppWrapper.js +198 -0
- package/v2Containers/InAppWrapper/index.js +146 -0
- package/v2Containers/InAppWrapper/messages.js +45 -0
- package/v2Containers/InappAdvance/index.js +1006 -0
- package/v2Containers/InappAdvance/index.scss +10 -0
- package/v2Containers/InappAdvance/tests/index.test.js +448 -0
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +3 -0
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +2 -0
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +2 -0
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +9 -0
- package/v2Containers/Rcs/index.js +3 -1
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +12 -0
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4 -0
- package/v2Containers/TagList/index.js +65 -1
- package/v2Containers/Templates/_templates.scss +49 -1
- package/v2Containers/Templates/index.js +93 -5
- package/v2Containers/Templates/messages.js +4 -0
- package/v2Containers/Templates/reducer.js +20 -7
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +8 -88
- package/v2Containers/Templates/tests/reducer.test.js +125 -0
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +35 -0
|
@@ -2281,6 +2281,7 @@ new message content.",
|
|
|
2281
2281
|
"email": [Function],
|
|
2282
2282
|
"facebookPreview": [Function],
|
|
2283
2283
|
"gallery": [Function],
|
|
2284
|
+
"inApp": [Function],
|
|
2284
2285
|
"language": [Function],
|
|
2285
2286
|
"navigationConfig": [Function],
|
|
2286
2287
|
"previewAndTest": [Function],
|
|
@@ -9335,6 +9336,7 @@ new message content.",
|
|
|
9335
9336
|
"email": [Function],
|
|
9336
9337
|
"facebookPreview": [Function],
|
|
9337
9338
|
"gallery": [Function],
|
|
9339
|
+
"inApp": [Function],
|
|
9338
9340
|
"language": [Function],
|
|
9339
9341
|
"navigationConfig": [Function],
|
|
9340
9342
|
"previewAndTest": [Function],
|
|
@@ -16195,6 +16197,7 @@ new message content.",
|
|
|
16195
16197
|
"email": [Function],
|
|
16196
16198
|
"facebookPreview": [Function],
|
|
16197
16199
|
"gallery": [Function],
|
|
16200
|
+
"inApp": [Function],
|
|
16198
16201
|
"language": [Function],
|
|
16199
16202
|
"navigationConfig": [Function],
|
|
16200
16203
|
"previewAndTest": [Function],
|
|
@@ -23055,6 +23058,7 @@ new message content.",
|
|
|
23055
23058
|
"email": [Function],
|
|
23056
23059
|
"facebookPreview": [Function],
|
|
23057
23060
|
"gallery": [Function],
|
|
23061
|
+
"inApp": [Function],
|
|
23058
23062
|
"language": [Function],
|
|
23059
23063
|
"navigationConfig": [Function],
|
|
23060
23064
|
"previewAndTest": [Function],
|
|
@@ -40,6 +40,7 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
40
40
|
tags: [],
|
|
41
41
|
tagsError: false,
|
|
42
42
|
currentContext: null, // Track current context to detect changes
|
|
43
|
+
hasTriggeredInitialApiCall: false, // Track if we've triggered API call when popover opens
|
|
43
44
|
};
|
|
44
45
|
this.renderTags = this.renderTags.bind(this);
|
|
45
46
|
this.populateTags = this.populateTags.bind(this);
|
|
@@ -51,6 +52,14 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
51
52
|
|
|
52
53
|
componentDidMount() {
|
|
53
54
|
this.generateTags(this.props);
|
|
55
|
+
// Trigger initial API call if tags are empty (similar to Email/SMS behavior)
|
|
56
|
+
const { tags, injectedTags, onContextChange } = this.props;
|
|
57
|
+
const hasNoTags = (!tags || tags.length === 0) && _.isEmpty(injectedTags);
|
|
58
|
+
if (hasNoTags && onContextChange) {
|
|
59
|
+
// Trigger API call with default 'Outbound' context to match CapTagList default
|
|
60
|
+
// This ensures tags are loaded when component mounts
|
|
61
|
+
this.getTagsforContext('Outbound');
|
|
62
|
+
}
|
|
54
63
|
}
|
|
55
64
|
|
|
56
65
|
componentWillReceiveProps(nextProps) {
|
|
@@ -76,6 +85,10 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
76
85
|
if (!_.isEqual(nextTags, currentTags)) {
|
|
77
86
|
this.setState({loading: false});
|
|
78
87
|
this.clearLoadingTimeout();
|
|
88
|
+
// Reset the flag when tags are received, so we can trigger API call again if needed
|
|
89
|
+
if (nextTags && nextTags.length > 0) {
|
|
90
|
+
this.setState({ hasTriggeredInitialApiCall: false });
|
|
91
|
+
}
|
|
79
92
|
}
|
|
80
93
|
if (fetchingSchemaError) {
|
|
81
94
|
this.setState({tagsError: fetchingSchemaError, loading: false});
|
|
@@ -109,6 +122,11 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
109
122
|
};
|
|
110
123
|
|
|
111
124
|
getTagsforContext = (data) => {
|
|
125
|
+
console.log('TagList getTagsforContext called', {
|
|
126
|
+
data,
|
|
127
|
+
hasOnContextChange: !!this.props.onContextChange,
|
|
128
|
+
});
|
|
129
|
+
|
|
112
130
|
// Set loading state when context change is requested
|
|
113
131
|
this.setState({loading: true, currentContext: data});
|
|
114
132
|
|
|
@@ -119,9 +137,54 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
119
137
|
}, 5000); // Reduced timeout to 5 seconds for better UX
|
|
120
138
|
|
|
121
139
|
const { onContextChange } = this.props;
|
|
122
|
-
onContextChange
|
|
140
|
+
// Always call onContextChange if available - this triggers the API call
|
|
141
|
+
// The API call will fetch tags from /meta/TAG endpoint
|
|
142
|
+
if (onContextChange) {
|
|
143
|
+
console.log('TagList: Calling onContextChange with data:', data);
|
|
144
|
+
onContextChange(data);
|
|
145
|
+
} else {
|
|
146
|
+
console.warn('TagList: onContextChange is not available. API call will not be triggered.');
|
|
147
|
+
}
|
|
123
148
|
}
|
|
124
149
|
|
|
150
|
+
handlePopoverVisibilityChange = (visible) => {
|
|
151
|
+
console.log('TagList handlePopoverVisibilityChange called', {
|
|
152
|
+
visible,
|
|
153
|
+
hasOnContextChange: !!this.props.onContextChange,
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
// When popover opens, trigger API call if tags are empty or if we haven't triggered it yet
|
|
157
|
+
// This ensures API call happens when user clicks "Add Label" button
|
|
158
|
+
if (visible && this.props.onContextChange) {
|
|
159
|
+
const { tags, injectedTags } = this.props;
|
|
160
|
+
// Check if tags array is empty or if state tags are empty
|
|
161
|
+
const hasNoTags = (!tags || tags.length === 0) && _.isEmpty(injectedTags);
|
|
162
|
+
const hasNoStateTags = _.isEmpty(this.state.tags);
|
|
163
|
+
const hasNotTriggeredApiCall = !this.state.hasTriggeredInitialApiCall;
|
|
164
|
+
|
|
165
|
+
console.log('TagList: Checking conditions for API call', {
|
|
166
|
+
hasNoTags,
|
|
167
|
+
hasNoStateTags,
|
|
168
|
+
hasNotTriggeredApiCall,
|
|
169
|
+
willTrigger: (hasNoTags || hasNoStateTags || hasNotTriggeredApiCall),
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
// Trigger API call if tags are not loaded yet OR if we haven't triggered it yet
|
|
173
|
+
if ((hasNoTags || hasNoStateTags || hasNotTriggeredApiCall)) {
|
|
174
|
+
// Mark that we've triggered the API call
|
|
175
|
+
this.setState({ hasTriggeredInitialApiCall: true });
|
|
176
|
+
console.log('TagList: Triggering API call with Outbound context');
|
|
177
|
+
// Trigger API call with default 'Outbound' context to match CapTagList default
|
|
178
|
+
// This will call onContextChange which triggers handleOnTagsContextChange in InApp
|
|
179
|
+
this.getTagsforContext('Outbound');
|
|
180
|
+
} else {
|
|
181
|
+
console.log('TagList: API call not triggered - conditions not met');
|
|
182
|
+
}
|
|
183
|
+
} else {
|
|
184
|
+
console.log('TagList: API call not triggered - popover not visible or onContextChange not available');
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
|
|
125
188
|
generateTags = (props) => {
|
|
126
189
|
let tags = {};
|
|
127
190
|
let injectedTags = {};
|
|
@@ -366,6 +429,7 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
366
429
|
visibleTaglist={this.props.visibleTaglist}
|
|
367
430
|
hidePopover={this.props.hidePopover}
|
|
368
431
|
onContextChange={this.getTagsforContext}
|
|
432
|
+
onVisibleChange={this.handlePopoverVisibilityChange}
|
|
369
433
|
moduleFilterEnabled={this.props.moduleFilterEnabled}
|
|
370
434
|
modalProps={this.props.modalProps}
|
|
371
435
|
currentOrgDetails={this.props.currentOrgDetails}
|
|
@@ -313,6 +313,53 @@
|
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
|
+
.INAPP {
|
|
317
|
+
margin-bottom: $CAP_SPACE_12;
|
|
318
|
+
.inapp-container {
|
|
319
|
+
margin-top: $CAP_SPACE_24;
|
|
320
|
+
}
|
|
321
|
+
// Modal Layout - centered
|
|
322
|
+
.inapp-modal-layout {
|
|
323
|
+
position: absolute;
|
|
324
|
+
display: flex;
|
|
325
|
+
width: 12rem;
|
|
326
|
+
top: 10%;
|
|
327
|
+
left: 10%;
|
|
328
|
+
background-color: $CAP_WHITE;
|
|
329
|
+
border-radius: $CAP_SPACE_08;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// Full Screen Layout
|
|
333
|
+
.inapp-fullscreen-layout {
|
|
334
|
+
position: absolute;
|
|
335
|
+
display: flex;
|
|
336
|
+
width: 12rem;
|
|
337
|
+
left: 10%;
|
|
338
|
+
background-color: $CAP_WHITE;
|
|
339
|
+
border-radius: $CAP_SPACE_08;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
// Top Banner Layout
|
|
343
|
+
.inapp-top-banner-layout {
|
|
344
|
+
position: absolute;
|
|
345
|
+
display: flex;
|
|
346
|
+
width: 12rem;
|
|
347
|
+
left: 10%;
|
|
348
|
+
background-color: $CAP_WHITE;
|
|
349
|
+
border-radius: $CAP_SPACE_08;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// Bottom Banner Layout
|
|
353
|
+
.inapp-bottom-banner-layout {
|
|
354
|
+
position: absolute;
|
|
355
|
+
display: flex;
|
|
356
|
+
justify-content: center;
|
|
357
|
+
width: 12rem;
|
|
358
|
+
left: 10%;
|
|
359
|
+
background-color: $CAP_WHITE;
|
|
360
|
+
border-radius: $CAP_SPACE_08;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
316
363
|
}
|
|
317
364
|
|
|
318
365
|
.create-new-link{
|
|
@@ -695,7 +742,8 @@
|
|
|
695
742
|
}
|
|
696
743
|
|
|
697
744
|
.whatsapp-filters,
|
|
698
|
-
.zalo-filters
|
|
745
|
+
.zalo-filters,
|
|
746
|
+
.inapp-filters {
|
|
699
747
|
display: flex;
|
|
700
748
|
width: 100%;
|
|
701
749
|
padding-left: 8px;
|
|
@@ -125,13 +125,14 @@ import {
|
|
|
125
125
|
VIDEO,
|
|
126
126
|
GIF,
|
|
127
127
|
} from '../Whatsapp/constants';
|
|
128
|
-
import { INAPP_LAYOUT_DETAILS } from '../InApp/constants';
|
|
128
|
+
import { INAPP_LAYOUT_DETAILS, INAPP_MESSAGE_LAYOUT_TYPES, INAPP_MEDIA_TYPES, BIG_HTML, ANDROID, IOS } from '../InApp/constants';
|
|
129
129
|
import { ZALO_STATUS_OPTIONS, ZALO_STATUSES } from '../Zalo/constants';
|
|
130
130
|
import { getWhatsappContent, getWhatsappStatus, getWhatsappCategory, getWhatsappCta, getWhatsappQuickReply, getWhatsappAutoFill, getWhatsappCarouselButtonView } from '../Whatsapp/utils';
|
|
131
131
|
import { getRCSContent } from '../Rcs/utils';
|
|
132
132
|
import {RCS_STATUSES} from '../Rcs/constants';
|
|
133
133
|
import zaloMessages from '../Zalo/messages';
|
|
134
134
|
import rcsMessages from '../Rcs/messages';
|
|
135
|
+
import inAppMessages from '../InApp/messages';
|
|
135
136
|
import globalMessages from '../../v2Containers/Cap/messages';
|
|
136
137
|
import { handlePreviewInNewTab } from '../../utils/common';
|
|
137
138
|
|
|
@@ -198,6 +199,29 @@ const SMS_FILTERS = {
|
|
|
198
199
|
SERVICE_IMPLICIT: 'implicit',
|
|
199
200
|
};
|
|
200
201
|
|
|
202
|
+
const INAPP_LAYOUT_OPTIONS = [
|
|
203
|
+
{
|
|
204
|
+
key: 'popup',
|
|
205
|
+
value: INAPP_MESSAGE_LAYOUT_TYPES.MODAL,
|
|
206
|
+
label: <FormattedMessage {...inAppMessages.layoutModal} />,
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
key: 'topBanner',
|
|
210
|
+
value: INAPP_MESSAGE_LAYOUT_TYPES.TOPBANNER,
|
|
211
|
+
label: <FormattedMessage {...inAppMessages.layoutTopBanner} />,
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
key: 'bottomBanner',
|
|
215
|
+
value: INAPP_MESSAGE_LAYOUT_TYPES.BOTTOMBANNER,
|
|
216
|
+
label: <FormattedMessage {...inAppMessages.layoutBottomBanner} />,
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
key: 'fullScreen',
|
|
220
|
+
value: INAPP_MESSAGE_LAYOUT_TYPES.FULLSCREEN,
|
|
221
|
+
label: <FormattedMessage {...inAppMessages.layoutFullScreen} />,
|
|
222
|
+
},
|
|
223
|
+
];
|
|
224
|
+
|
|
201
225
|
const WHATSAPP_LOWERCASE = WHATSAPP.toLowerCase();
|
|
202
226
|
const RCS_LOWERCASE = RCS.toLowerCase();
|
|
203
227
|
const SMS_LOWERCASE = SMS.toLowerCase();
|
|
@@ -248,6 +272,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
248
272
|
selectedWhatsappStatus: '',
|
|
249
273
|
selectedWhatsappCategory: '',
|
|
250
274
|
selectedZaloStatus: '',
|
|
275
|
+
selectedInAppLayout: '',
|
|
251
276
|
hostName: '',
|
|
252
277
|
searchedZaloTemplates: [],
|
|
253
278
|
searchingZaloTemplate: false,
|
|
@@ -782,6 +807,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
782
807
|
const {name, sourceAccountIdentifier, configs } = weCrmAccountsList?.[0] || {};
|
|
783
808
|
if (isSingleAccount) {
|
|
784
809
|
weCrmAccountsList[0].hostName = hostName;
|
|
810
|
+
this.setState({ selectedAccount: name });
|
|
785
811
|
} else {
|
|
786
812
|
selectedAccount.hostName = hostName;
|
|
787
813
|
}
|
|
@@ -1135,6 +1161,19 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1135
1161
|
return templates;
|
|
1136
1162
|
}
|
|
1137
1163
|
|
|
1164
|
+
filterInAppTemplates = (templates) => {
|
|
1165
|
+
const { selectedInAppLayout } = this.state;
|
|
1166
|
+
if (!selectedInAppLayout) {
|
|
1167
|
+
return templates;
|
|
1168
|
+
}
|
|
1169
|
+
return templates.filter((template) => {
|
|
1170
|
+
const androidBodyType = get(template, 'versions.base.content.ANDROID.bodyType');
|
|
1171
|
+
const iosBodyType = get(template, 'versions.base.content.IOS.bodyType');
|
|
1172
|
+
const inappBodyType = androidBodyType || iosBodyType;
|
|
1173
|
+
return inappBodyType === selectedInAppLayout;
|
|
1174
|
+
});
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1138
1177
|
filterSMSTemplates = (templates) => {
|
|
1139
1178
|
const { smsFilter } = this.state;
|
|
1140
1179
|
if (SMS_FILTERS.ALL === smsFilter) {
|
|
@@ -1221,6 +1260,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1221
1260
|
case ZALO:
|
|
1222
1261
|
filteredTemplates = this.filterZaloTemplates(templates);
|
|
1223
1262
|
break;
|
|
1263
|
+
case INAPP:
|
|
1264
|
+
filteredTemplates = this.filterInAppTemplates(templates);
|
|
1265
|
+
break;
|
|
1224
1266
|
default:
|
|
1225
1267
|
break;
|
|
1226
1268
|
}
|
|
@@ -1440,9 +1482,12 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1440
1482
|
templateData.isNewMobilePush = commonUtil.hasNewMobilePushFeatureEnabled();
|
|
1441
1483
|
}
|
|
1442
1484
|
break;
|
|
1443
|
-
case INAPP:
|
|
1485
|
+
case INAPP: {
|
|
1486
|
+
// Pass the full template object to CapCustomCard so getInAppContent can extract the data
|
|
1487
|
+
// Similar to how MOBILE_PUSH passes the full template when new feature is enabled
|
|
1444
1488
|
templateData.content = template;
|
|
1445
1489
|
break;
|
|
1490
|
+
}
|
|
1446
1491
|
case WECHAT:
|
|
1447
1492
|
templateData.content = this.prepareWeChatPreviewData(template);
|
|
1448
1493
|
break;
|
|
@@ -1756,7 +1801,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1756
1801
|
return (<div>
|
|
1757
1802
|
{[WECHAT, MOBILE_PUSH, INAPP, WHATSAPP, ZALO].includes(currentChannel) && this.showAccountName()}
|
|
1758
1803
|
{filterContent}
|
|
1759
|
-
{[WHATSAPP, ZALO].includes(currentChannel) && this.selectedFilters()}
|
|
1804
|
+
{[WHATSAPP, ZALO, INAPP].includes(currentChannel) && this.selectedFilters()}
|
|
1760
1805
|
{<div>
|
|
1761
1806
|
{!isEmpty(filteredTemplates) || !isEmpty(this.state.searchText) || !isEmpty(this.props.Templates.templateError) ? (
|
|
1762
1807
|
<div className={!isEmpty(this.state.searchText) && isEmpty(cardDataList) ? '' : this.isFullMode() ? "v2-pagination-container" : "v2-pagination-container-half"}>
|
|
@@ -1966,6 +2011,9 @@ return (<div>
|
|
|
1966
2011
|
|
|
1967
2012
|
prepareWeChatMappedPreviewData(content, templateTags, tagData) {
|
|
1968
2013
|
let formattedContent = cloneDeep(content);
|
|
2014
|
+
if (!formattedContent || typeof formattedContent !== 'string') {
|
|
2015
|
+
return formattedContent || '';
|
|
2016
|
+
}
|
|
1969
2017
|
forEach(templateTags, (tag) => {
|
|
1970
2018
|
if (tagData[tag].value !== undefined) {
|
|
1971
2019
|
formattedContent = formattedContent.replace(`{{${tag}.DATA}}`, tagData[tag].value);
|
|
@@ -2885,6 +2933,7 @@ return (<div>
|
|
|
2885
2933
|
fetchingWeCrmAccounts ) &&
|
|
2886
2934
|
this.state.channel.toLowerCase() === ZALO_LOWERCASE;
|
|
2887
2935
|
const mobilePushLoader = (((getAllTemplatesInProgress) || (fetchingWeCrmAccounts)) && this.state.channel.toLowerCase() === 'mobilepush');
|
|
2936
|
+
const inAppLoader = (((this.state.selectedAccount !== '' && getAllTemplatesInProgress) || (fetchingWeCrmAccounts)) && this.state.channel.toLowerCase() === INAPP_LOWERCASE);
|
|
2888
2937
|
const emailLoader = (
|
|
2889
2938
|
(getAllTemplatesInProgress ||
|
|
2890
2939
|
sendingFile ||
|
|
@@ -2901,6 +2950,7 @@ return (<div>
|
|
|
2901
2950
|
(lineLoader !== undefined ? lineLoader : false) ||
|
|
2902
2951
|
(facebookLoader !== undefined ? facebookLoader : false) ||
|
|
2903
2952
|
(viberLoader !== undefined ? viberLoader : false) ||
|
|
2953
|
+
(inAppLoader !== undefined ? inAppLoader : false) ||
|
|
2904
2954
|
(rcsLoader !== undefined ? rcsLoader : false);
|
|
2905
2955
|
return isLoading;
|
|
2906
2956
|
}
|
|
@@ -3134,7 +3184,7 @@ return (<div>
|
|
|
3134
3184
|
return (activeMode !== ACCOUNT_CHANGE_MODE &&
|
|
3135
3185
|
<CapHeader
|
|
3136
3186
|
title={<CapHeading type="h4">{this.accountNameMessage(channel)}</CapHeading>}
|
|
3137
|
-
description={<><CapHeading type="h3">{selectedAccount}
|
|
3187
|
+
description={weCrmAccounts.length > 1 && <><CapHeading type="h3">{selectedAccount} <CapLink onClick={this.setAccountChangeMode} style={{display: 'inline-block', position: 'relative', top: '3px'}} fontWeight="regular" fontSize="14px" title="change"/> </CapHeading></>}
|
|
3138
3188
|
size="regular"
|
|
3139
3189
|
/>);
|
|
3140
3190
|
}
|
|
@@ -3153,14 +3203,19 @@ return (<div>
|
|
|
3153
3203
|
}
|
|
3154
3204
|
|
|
3155
3205
|
removeZaloFilter = () => this.setState({ selectedZaloStatus: null });
|
|
3206
|
+
removeInAppLayoutFilter = () => this.setState({ selectedInAppLayout: '' });
|
|
3156
3207
|
|
|
3157
3208
|
selectedFilters = () => {
|
|
3158
|
-
const { selectedWhatsappStatus, selectedWhatsappCategory, selectedZaloStatus } = this.state;
|
|
3209
|
+
const { selectedWhatsappStatus, selectedWhatsappCategory, selectedZaloStatus, selectedInAppLayout } = this.state;
|
|
3159
3210
|
const {
|
|
3160
3211
|
intl: {
|
|
3161
3212
|
formatMessage,
|
|
3162
3213
|
},
|
|
3163
3214
|
} = this.props;
|
|
3215
|
+
const getInAppLayoutLabel = (layoutValue) => {
|
|
3216
|
+
const layoutOption = INAPP_LAYOUT_OPTIONS.find(opt => opt.value === layoutValue);
|
|
3217
|
+
return layoutOption ? layoutOption.label : layoutValue;
|
|
3218
|
+
};
|
|
3164
3219
|
return (
|
|
3165
3220
|
<CapRow type="flex" align="middle" className="selected-whatsapp-filters">
|
|
3166
3221
|
{
|
|
@@ -3195,6 +3250,23 @@ return (<div>
|
|
|
3195
3250
|
</CapTag>
|
|
3196
3251
|
) : null
|
|
3197
3252
|
}
|
|
3253
|
+
{
|
|
3254
|
+
selectedInAppLayout ? (
|
|
3255
|
+
<CapTag closable onClose={this.removeInAppLayoutFilter}>
|
|
3256
|
+
{formatMessage(messages.layout)}: {getInAppLayoutLabel(selectedInAppLayout)}
|
|
3257
|
+
</CapTag>
|
|
3258
|
+
) : null
|
|
3259
|
+
}
|
|
3260
|
+
{
|
|
3261
|
+
selectedInAppLayout ? (
|
|
3262
|
+
<CapLink
|
|
3263
|
+
onClick={() => {
|
|
3264
|
+
this.removeInAppLayoutFilter();
|
|
3265
|
+
}}
|
|
3266
|
+
title={this.props.intl.formatMessage(messages.clearAll)}
|
|
3267
|
+
/>
|
|
3268
|
+
) : null
|
|
3269
|
+
}
|
|
3198
3270
|
</CapRow>
|
|
3199
3271
|
);
|
|
3200
3272
|
}
|
|
@@ -3205,6 +3277,7 @@ return (<div>
|
|
|
3205
3277
|
setLineFilter = (e) => this.setState({lineFilter: e.target.value});
|
|
3206
3278
|
setSMSFilter = (e) => this.setState({smsFilter: e.target.value});
|
|
3207
3279
|
setZaloStatus = (value) => this.setState({selectedZaloStatus: value?.item?.props?.value});
|
|
3280
|
+
setInAppLayout = (value) => this.setState({selectedInAppLayout: value?.item?.props?.value});
|
|
3208
3281
|
|
|
3209
3282
|
openCreativesFullMode = () => {
|
|
3210
3283
|
const channelLowerCase = this.state.channel.toLowerCase();
|
|
@@ -3458,6 +3531,21 @@ return (<div>
|
|
|
3458
3531
|
)
|
|
3459
3532
|
: () => null
|
|
3460
3533
|
}
|
|
3534
|
+
{
|
|
3535
|
+
channel.toUpperCase() === INAPP && (
|
|
3536
|
+
<div className="inapp-filters">
|
|
3537
|
+
<CapSelectFilter
|
|
3538
|
+
placement="bottomLeft"
|
|
3539
|
+
data={INAPP_LAYOUT_OPTIONS}
|
|
3540
|
+
onSelect={this.setInAppLayout}
|
|
3541
|
+
selectedValue={this.state.selectedInAppLayout}
|
|
3542
|
+
placeholder="Layout"
|
|
3543
|
+
showBadge
|
|
3544
|
+
width="120px"
|
|
3545
|
+
/>
|
|
3546
|
+
</div>
|
|
3547
|
+
)
|
|
3548
|
+
}
|
|
3461
3549
|
<div style={{display: "flex", justifyContent: "space-between", alignItems: 'center'}}>
|
|
3462
3550
|
{
|
|
3463
3551
|
this.state?.channel?.toLowerCase() === WHATSAPP_LOWERCASE && (isWhatsappCountExeeded)? (
|
|
@@ -526,6 +526,10 @@ export default defineMessages({
|
|
|
526
526
|
id: `${scope}.rcsOnlyApprovedTemplates`,
|
|
527
527
|
defaultMessage: 'Only "Approved" templates are available here, as you can use those templates to create a message.',
|
|
528
528
|
},
|
|
529
|
+
"layout": {
|
|
530
|
+
id: `${scope}.layout`,
|
|
531
|
+
defaultMessage: `Layout`,
|
|
532
|
+
},
|
|
529
533
|
"status": {
|
|
530
534
|
id: `${scope}.status`,
|
|
531
535
|
defaultMessage: 'Status',
|
|
@@ -98,19 +98,32 @@ function templatesReducer(state = initialState, action) {
|
|
|
98
98
|
.set('weCrmAccountFetchingError', true);
|
|
99
99
|
case types.SET_WECHAT_ACCOUNT:
|
|
100
100
|
return state
|
|
101
|
-
.set('selectedWeChatAccount', fromJS(action.weChatAccount))
|
|
101
|
+
.set('selectedWeChatAccount', fromJS(action.weChatAccount))
|
|
102
|
+
.set('templates', []);
|
|
102
103
|
case types.SET_LINE_ACCOUNT:
|
|
103
|
-
return state
|
|
104
|
+
return state
|
|
105
|
+
.set('selectedLineAccount', fromJS(action.account))
|
|
106
|
+
.set('templates', []);
|
|
104
107
|
case types.SET_VIBER_ACCOUNT:
|
|
105
|
-
return state
|
|
108
|
+
return state
|
|
109
|
+
.set('selectedViberAccount', fromJS(action.viberAccount))
|
|
110
|
+
.set('templates', []);
|
|
106
111
|
case types.SET_WHATSAPP_ACCOUNT:
|
|
107
|
-
return state
|
|
112
|
+
return state
|
|
113
|
+
.set('selectedWhatsappAccount', fromJS(action.account))
|
|
114
|
+
.set('templates', []);
|
|
108
115
|
case types.SET_ZALO_ACCOUNT:
|
|
109
|
-
return state
|
|
116
|
+
return state
|
|
117
|
+
.set('selectedZaloAccount', fromJS(action.account))
|
|
118
|
+
.set('templates', []);
|
|
110
119
|
case types.SET_RCS_ACCOUNT:
|
|
111
|
-
return state
|
|
120
|
+
return state
|
|
121
|
+
.set('selectedRcsAccount', fromJS(action.rcsAccount))
|
|
122
|
+
.set('templates', []);
|
|
112
123
|
case types.SET_FACEBOOK_ACCOUNT:
|
|
113
|
-
return state
|
|
124
|
+
return state
|
|
125
|
+
.set('selectedFacebookAccount', fromJS(action.faceBookAccount))
|
|
126
|
+
.set('templates', []);
|
|
114
127
|
case types.RESET_ACCOUNT:
|
|
115
128
|
return state
|
|
116
129
|
.remove('selectedWeChatAccount')
|
|
@@ -390,17 +390,7 @@ exports[`Test Templates container Should render temlates when whatsapp templates
|
|
|
390
390
|
>
|
|
391
391
|
<div>
|
|
392
392
|
<CapHeader
|
|
393
|
-
description={
|
|
394
|
-
<React.Fragment>
|
|
395
|
-
<CapHeading
|
|
396
|
-
type="h3"
|
|
397
|
-
>
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
</CapHeading>
|
|
402
|
-
</React.Fragment>
|
|
403
|
-
}
|
|
393
|
+
description={false}
|
|
404
394
|
descriptionClass=""
|
|
405
395
|
inline={false}
|
|
406
396
|
size="regular"
|
|
@@ -647,17 +637,7 @@ exports[`Test Templates container Should render temlates when whatsapp templates
|
|
|
647
637
|
>
|
|
648
638
|
<div>
|
|
649
639
|
<CapHeader
|
|
650
|
-
description={
|
|
651
|
-
<React.Fragment>
|
|
652
|
-
<CapHeading
|
|
653
|
-
type="h3"
|
|
654
|
-
>
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
</CapHeading>
|
|
659
|
-
</React.Fragment>
|
|
660
|
-
}
|
|
640
|
+
description={false}
|
|
661
641
|
descriptionClass=""
|
|
662
642
|
inline={false}
|
|
663
643
|
size="regular"
|
|
@@ -1072,17 +1052,7 @@ exports[`Test Templates container Test max templates exceeded 1`] = `
|
|
|
1072
1052
|
>
|
|
1073
1053
|
<div>
|
|
1074
1054
|
<CapHeader
|
|
1075
|
-
description={
|
|
1076
|
-
<React.Fragment>
|
|
1077
|
-
<CapHeading
|
|
1078
|
-
type="h3"
|
|
1079
|
-
>
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
</CapHeading>
|
|
1084
|
-
</React.Fragment>
|
|
1085
|
-
}
|
|
1055
|
+
description={false}
|
|
1086
1056
|
descriptionClass=""
|
|
1087
1057
|
inline={false}
|
|
1088
1058
|
size="regular"
|
|
@@ -1558,17 +1528,7 @@ exports[`Test Templates container Test max templates not exceeded 1`] = `
|
|
|
1558
1528
|
>
|
|
1559
1529
|
<div>
|
|
1560
1530
|
<CapHeader
|
|
1561
|
-
description={
|
|
1562
|
-
<React.Fragment>
|
|
1563
|
-
<CapHeading
|
|
1564
|
-
type="h3"
|
|
1565
|
-
>
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
</CapHeading>
|
|
1570
|
-
</React.Fragment>
|
|
1571
|
-
}
|
|
1531
|
+
description={false}
|
|
1572
1532
|
descriptionClass=""
|
|
1573
1533
|
inline={false}
|
|
1574
1534
|
size="regular"
|
|
@@ -2044,17 +2004,7 @@ exports[`Test Templates container Test max templates warning 1`] = `
|
|
|
2044
2004
|
>
|
|
2045
2005
|
<div>
|
|
2046
2006
|
<CapHeader
|
|
2047
|
-
description={
|
|
2048
|
-
<React.Fragment>
|
|
2049
|
-
<CapHeading
|
|
2050
|
-
type="h3"
|
|
2051
|
-
>
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
</CapHeading>
|
|
2056
|
-
</React.Fragment>
|
|
2057
|
-
}
|
|
2007
|
+
description={false}
|
|
2058
2008
|
descriptionClass=""
|
|
2059
2009
|
inline={false}
|
|
2060
2010
|
size="regular"
|
|
@@ -2530,17 +2480,7 @@ exports[`Test Templates container Test removing all whatsapp filterss 1`] = `
|
|
|
2530
2480
|
>
|
|
2531
2481
|
<div>
|
|
2532
2482
|
<CapHeader
|
|
2533
|
-
description={
|
|
2534
|
-
<React.Fragment>
|
|
2535
|
-
<CapHeading
|
|
2536
|
-
type="h3"
|
|
2537
|
-
>
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
</CapHeading>
|
|
2542
|
-
</React.Fragment>
|
|
2543
|
-
}
|
|
2483
|
+
description={false}
|
|
2544
2484
|
descriptionClass=""
|
|
2545
2485
|
inline={false}
|
|
2546
2486
|
size="regular"
|
|
@@ -2813,17 +2753,7 @@ exports[`Test Templates container Test removing all whatsapp filterss 2`] = `
|
|
|
2813
2753
|
>
|
|
2814
2754
|
<div>
|
|
2815
2755
|
<CapHeader
|
|
2816
|
-
description={
|
|
2817
|
-
<React.Fragment>
|
|
2818
|
-
<CapHeading
|
|
2819
|
-
type="h3"
|
|
2820
|
-
>
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
</CapHeading>
|
|
2825
|
-
</React.Fragment>
|
|
2826
|
-
}
|
|
2756
|
+
description={false}
|
|
2827
2757
|
descriptionClass=""
|
|
2828
2758
|
inline={false}
|
|
2829
2759
|
size="regular"
|
|
@@ -3070,17 +3000,7 @@ exports[`Test Templates container Test removing single filter 1`] = `
|
|
|
3070
3000
|
>
|
|
3071
3001
|
<div>
|
|
3072
3002
|
<CapHeader
|
|
3073
|
-
description={
|
|
3074
|
-
<React.Fragment>
|
|
3075
|
-
<CapHeading
|
|
3076
|
-
type="h3"
|
|
3077
|
-
>
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
</CapHeading>
|
|
3082
|
-
</React.Fragment>
|
|
3083
|
-
}
|
|
3003
|
+
description={false}
|
|
3084
3004
|
descriptionClass=""
|
|
3085
3005
|
inline={false}
|
|
3086
3006
|
size="regular"
|